From df52f57560c0eef590221cf759bdbd94971e8394 Mon Sep 17 00:00:00 2001 From: pcarana Date: Thu, 7 Nov 2019 10:52:41 -0600 Subject: [PATCH] Update function 'log_debug_enabled' and add 'log_info_enabled' function --- src/log.c | 8 +++++++- src/log.h | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index ad87d2de..9a5a2144 100644 --- a/src/log.c +++ b/src/log.c @@ -188,7 +188,13 @@ pr_stream(int level, const char *format, va_list args) bool log_debug_enabled(void) { - return config_get_log_level() == LOG_DEBUG; + return config_get_log_level() >= LOG_DEBUG; +} + +bool +log_info_enabled(void) +{ + return config_get_log_level() >= LOG_INFO; } void diff --git a/src/log.h b/src/log.h index e490e087..75c5b675 100644 --- a/src/log.h +++ b/src/log.h @@ -49,8 +49,11 @@ void log_teardown(void); * error stack) cannot exceed 512 bytes at present. */ -/* Check if debug is enabled, useful to avoid boilerplate code */ +/* + * Check if debug or info are enabled, useful to avoid boilerplate code + */ bool log_debug_enabled(void); +bool log_info_enabled(void); /* Debug messages, useful for devs or to track a specific problem */ void pr_debug(const char *, ...) CHECK_FORMAT(1, 2); -- 2.47.3