configure.ac: Replace --enable-verbose-usb-comms with a new runtime log level.

--enable-verbose actually did the same as --enable-verbose-usb-comms,
so the new code replaces it too.

Change-Id: I1d1ddd5d681009663e0c52a75ad76fe71dbc172a
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9281
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
This commit is contained in:
R. Diez
2025-12-01 19:09:42 +01:00
committed by Antonio Borneo
parent 50fdce21a0
commit ea9afa9e3e
9 changed files with 58 additions and 110 deletions
+4 -3
View File
@@ -53,13 +53,14 @@ static int64_t last_time;
static int64_t start;
static const char * const log_strings[6] = {
static const char * const log_strings[7] = {
"User : ",
"Error: ",
"Warn : ", /* want a space after each colon, all same width, colons aligned */
"Info : ",
"Debug: ",
"Debug: "
"Debug: ",
"Debug: ", /* corresponds to LOG_LVL_DEBUG_USB */
};
static int count;
@@ -212,7 +213,7 @@ COMMAND_HANDLER(handle_debug_level_command)
} else if (CMD_ARGC == 1) {
int new_level;
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], new_level);
if ((new_level > LOG_LVL_DEBUG_IO) || (new_level < LOG_LVL_SILENT)) {
if (new_level > LOG_LVL_DEBUG_USB || new_level < LOG_LVL_SILENT) {
command_print(CMD, "level must be between %d and %d", LOG_LVL_SILENT, LOG_LVL_DEBUG_IO);
return ERROR_COMMAND_ARGUMENT_INVALID;
}
+6
View File
@@ -37,6 +37,9 @@
* LOG_LVL_INFO - state information, etc.
* LOG_LVL_DEBUG - debug statements, execution trace
* LOG_LVL_DEBUG_IO - verbose debug, low-level I/O trace
* LOG_LVL_DEBUG_USB - verbose USB trace
* In the past this corresponded to build configuration options
--enable-verbose and --enable-verbose-usb-comms.
*/
enum log_levels {
LOG_LVL_SILENT = -3,
@@ -47,6 +50,7 @@ enum log_levels {
LOG_LVL_INFO = 2,
LOG_LVL_DEBUG = 3,
LOG_LVL_DEBUG_IO = 4,
LOG_LVL_DEBUG_USB = 5,
};
void log_printf(enum log_levels level, const char *file, unsigned int line,
@@ -100,6 +104,8 @@ extern int debug_level;
#define LOG_LEVEL_IS(FOO) ((debug_level) >= (FOO))
#define LOG_DEBUG_USB(expr, ...) LOG_CUSTOM_LEVEL(LOG_LVL_DEBUG_USB, expr, ##__VA_ARGS__)
#define LOG_DEBUG_IO(expr ...) \
do { \
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \