summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-23 12:14:05 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-25 10:29:06 -0800
commita3d81eed4d2aac51056f36d7c00ee639bb39c552 (patch)
treef2bef9fd0c98145a10070e904dedc8f1663d1edc /src/helper
parentbe482a5335dd35ee1fa163faa0af481b2ec65b70 (diff)
downloadopenocd+libswd-a3d81eed4d2aac51056f36d7c00ee639bb39c552.tar.gz
openocd+libswd-a3d81eed4d2aac51056f36d7c00ee639bb39c552.tar.bz2
openocd+libswd-a3d81eed4d2aac51056f36d7c00ee639bb39c552.tar.xz
openocd+libswd-a3d81eed4d2aac51056f36d7c00ee639bb39c552.zip
support OPENOCD_DEBUG_LEVEL environment setting
Detect the OPENOCD_DEBUG_LEVEL setting in log_init(), allowing the very early startup phases to be debugged.
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/log.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/helper/log.c b/src/helper/log.c
index 27fa8317..3067ecc5 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -346,6 +346,19 @@ void log_init(void)
if (debug_level == -1)
debug_level = LOG_LVL_INFO;
+ char *debug_env = getenv("OPENOCD_DEBUG_LEVEL");
+ if (NULL != debug_env)
+ {
+ int value;
+ int retval = parse_int(debug_env, &value);
+ if (ERROR_OK == retval &&
+ debug_level >= LOG_LVL_SILENT &&
+ debug_level <= LOG_LVL_DEBUG)
+ {
+ debug_level = value;
+ }
+ }
+
if (log_output == NULL)
log_output = stderr;