This is an automated email from Gerrit. "zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8996
-- gerrit commit d57958aa4768835f0abdc8918310aa908fd1a2a8 Author: Marc Schink <d...@zapb.de> Date: Sun Jul 13 09:05:40 2025 +0200 helper/log: Rework 'debug_level' command The patch changes the following: - Use correct return value ERROR_COMMAND_ARGUMENT_INVALID is case an invalid debug level is provided. - Do not echo the selected debug level. - Remove the 'debug_level: ' prefix when the debug level is shown. This makes processing via Tcl easier. - Use command_print() in order to provide the error message to the caller. Change-Id: Ida84a58c61060497fc36a1926eec7dd30c66cd72 Signed-off-by: Marc Schink <d...@zapb.de> diff --git a/src/helper/log.c b/src/helper/log.c index 8f7ab00397..7b48554b75 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -207,18 +207,19 @@ void log_printf_lf(enum log_levels level, COMMAND_HANDLER(handle_debug_level_command) { - if (CMD_ARGC == 1) { + if (!CMD_ARGC) { + command_print(CMD, "%i", debug_level); + } 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)) { - LOG_ERROR("level must be between %d and %d", LOG_LVL_SILENT, LOG_LVL_DEBUG_IO); - return ERROR_COMMAND_SYNTAX_ERROR; + command_print(CMD, "level must be between %d and %d", LOG_LVL_SILENT, LOG_LVL_DEBUG_IO); + return ERROR_COMMAND_ARGUMENT_INVALID; } debug_level = new_level; - } else if (CMD_ARGC > 1) + } else { return ERROR_COMMAND_SYNTAX_ERROR; - - command_print(CMD, "debug_level: %i", debug_level); + } return ERROR_OK; } --