]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
log: rework lxc_log_get_level()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 30 Jan 2021 11:10:09 +0000 (12:10 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 30 Jan 2021 11:10:09 +0000 (12:10 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/log.c

index bc60083fe30ea5a1b91ea11e06389f4c9e8da14a..7f1d5a86121c34978b29960ddf92787c6b671cbf 100644 (file)
@@ -778,7 +778,16 @@ int lxc_log_set_level(int *dest, int level)
 
 int lxc_log_get_level(void)
 {
-       return lxc_log_category_lxc.priority;
+       int level = LXC_LOG_LEVEL_NOTSET;
+
+#ifndef NO_LXC_CONF
+       if (current_config)
+               level = current_config->loglevel;
+#endif
+       if (level == LXC_LOG_LEVEL_NOTSET)
+               level = lxc_log_category_lxc.priority;
+
+       return level;
 }
 
 bool lxc_log_has_valid_level(void)