From b302c604ab0a84204dd99083f04c505db851002f Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 22 Jun 2022 12:59:50 +0200 Subject: Display log level information in preferences --- src/log.c | 17 +++++++++++++++++ src/log.h | 1 + src/ui/console.c | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/src/log.c b/src/log.c index 6aeb6ecf..d2ab58ac 100644 --- a/src/log.c +++ b/src/log.c @@ -225,6 +225,23 @@ log_level_from_string(char* log_level) } } +const char* +log_string_from_level(log_level_t level) +{ + switch (level) { + case PROF_LEVEL_ERROR: + return "ERROR"; + case PROF_LEVEL_WARN: + return "WARN"; + case PROF_LEVEL_INFO: + return "INFO"; + case PROF_LEVEL_DEBUG: + return "DEBUG"; + default: + return "LOG"; + } +} + static void _rotate_log_file(void) { diff --git a/src/log.h b/src/log.h index 00e40fb6..596227d2 100644 --- a/src/log.h +++ b/src/log.h @@ -63,6 +63,7 @@ void log_warning(const char* const msg, ...); void log_error(const char* const msg, ...); void log_msg(log_level_t level, const char* const area, const char* const msg); log_level_t log_level_from_string(char* log_level); +const char* log_string_from_level(log_level_t level); void log_stderr_init(log_level_t level); void log_stderr_close(void); diff --git a/src/ui/console.c b/src/ui/console.c index 2c4a8e41..b2a8a053 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -2018,6 +2018,10 @@ cons_log_setting(void) cons_show("Shared log (/log shared) : ON"); else cons_show("Shared log (/log shared) : OFF"); + + log_level_t filter = log_get_filter(); + const gchar *level = log_string_from_level(filter); + cons_show("Log level (/log level) : %s", level); } void -- cgit 1.4.1-2-gfad0