about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-06-22 12:59:50 +0200
committerMichael Vetter <jubalh@iodoru.org>2022-06-22 13:05:11 +0200
commitb302c604ab0a84204dd99083f04c505db851002f (patch)
tree7e348402d7ce2ea2b973eec4b7fe673de92eeafd
parentff8065eaca84b26d8d6de7bbaa03420204b36764 (diff)
downloadprofani-tty-b302c604ab0a84204dd99083f04c505db851002f.tar.gz
Display log level information in preferences
-rw-r--r--src/log.c17
-rw-r--r--src/log.h1
-rw-r--r--src/ui/console.c4
3 files changed, 22 insertions, 0 deletions
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