From: Zachary T Welch Date: Mon, 23 Nov 2009 20:14:05 +0000 (-0800) Subject: support OPENOCD_DEBUG_LEVEL environment setting X-Git-Tag: v0.4.0-rc1~328 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=a3d81eed4d2aac51056f36d7c00ee639bb39c552;ds=sidebyside support OPENOCD_DEBUG_LEVEL environment setting Detect the OPENOCD_DEBUG_LEVEL setting in log_init(), allowing the very early startup phases to be debugged. --- diff --git a/src/helper/log.c b/src/helper/log.c index 27fa8317aa..3067ecc561 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;