diff options
author | Sean Anderson <seanga2@gmail.com> | 2020-10-28 02:55:35 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-30 17:56:11 +0300 |
commit | 018aad8750181590f84afc42512216946f6caeab (patch) | |
tree | 37acb059b2fe2ccb5602798f54f8767f0d18b4f9 /cmd | |
parent | 1c593a105abd3ab5f551e04fbb427a56a4120cc9 (diff) | |
download | u-boot-018aad8750181590f84afc42512216946f6caeab.tar.xz |
cmd: log: Make "log level" print all log levels
This makes the log level command print all valid log levels. The default
log level is annotated. This provides an easy way to see which log levels
are compiled-in.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/log.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -34,14 +34,20 @@ static enum log_level_t parse_log_level(char *const arg) static int do_log_level(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + enum log_level_t log_level; + if (argc > 1) { - enum log_level_t log_level = parse_log_level(argv[1]); + log_level = parse_log_level(argv[1]); if (log_level == LOGL_NONE) return CMD_RET_FAILURE; gd->default_log_level = log_level; } else { - printf("Default log level: %d\n", gd->default_log_level); + for (log_level = LOGL_FIRST; log_level <= _LOG_MAX_LEVEL; + log_level++) + printf("%s%s\n", log_get_level_name(log_level), + log_level == gd->default_log_level ? + " (default)" : ""); } return CMD_RET_SUCCESS; @@ -153,7 +159,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char log_help_text[] = - "level - get/set log level\n" + "level [<level>] - get/set log level\n" "categories - list log categories\n" "drivers - list log drivers\n" "log format <fmt> - set log output format. <fmt> is a string where\n" |