This is an automated email from Gerrit.

"Dietmar May <dietmar....@outlook.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6471

-- gerrit

commit cb82f7132300791a3635dbf2c5dee897e626bd9e
Author: Dietmar May <dietmar....@outlook.com>
Date:   Thu Aug 19 10:52:36 2021 -0400

    Add trace logging.
    
    Adds a logging level between info and debug, for seeing interaction with
    the target without seeing the verbose debug dump output.
    
    Signed-off-by: Dietmar May <dietmar....@outlook.com>
    Change-Id: Ide895d9ca3be75945a2725bf0c964a5a7b9c8fef

diff --git a/src/helper/log.c b/src/helper/log.c
index caa0a66bf..54f7cd135 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -51,11 +51,12 @@ static int64_t current_time;
 
 static int64_t start;
 
-static const char * const log_strings[6] = {
+static const char * const log_strings[LOG_LVL_DEBUG_IO - LOG_LVL_USER + 1] = {
        "User : ",
        "Error: ",
        "Warn : ",      /* want a space after each colon, all same width, 
colons aligned */
        "Info : ",
+       "Trace: ",
        "Debug: ",
        "Debug: "
 };
diff --git a/src/helper/log.h b/src/helper/log.h
index 34ff835b8..a1b1c08f3 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -55,8 +55,9 @@ enum log_levels {
        LOG_LVL_ERROR = 0,
        LOG_LVL_WARNING = 1,
        LOG_LVL_INFO = 2,
-       LOG_LVL_DEBUG = 3,
-       LOG_LVL_DEBUG_IO = 4,
+       LOG_LVL_TRACE = 3,
+       LOG_LVL_DEBUG = 4,
+       LOG_LVL_DEBUG_IO = 5,
 };
 
 void log_printf(enum log_levels level, const char *file, unsigned line,
@@ -125,6 +126,9 @@ extern int debug_level;
                                expr); \
        } while (0)
 
+#define LOG_TRACE(expr ...) \
+       log_printf_lf(LOG_LVL_TRACE, __FILE__, __LINE__, __func__, expr)
+
 #define LOG_INFO(expr ...) \
        log_printf_lf(LOG_LVL_INFO, __FILE__, __LINE__, __func__, expr)
 
diff --git a/src/helper/options.c b/src/helper/options.c
index 199672789..da97e75a2 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -308,7 +308,7 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int 
argc, char *argv[])
                                break;
                        case 'd':               /* --debug | -d */
                        {
-                               int retval = command_run_linef(cmd_ctx, 
"debug_level %s", optarg ? optarg : "3");
+                               int retval = command_run_linef(cmd_ctx, 
"debug_level %s", optarg ? optarg : "4");
                                if (retval != ERROR_OK)
                                        return retval;
                                break;

-- 

Reply via email to