From 4341e843322919ea4aab895f03e1897fcb86d789 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 24 Aug 2021 10:40:56 +0100 Subject: [PATCH] [Minor] Allow to get logger level --- src/libserver/logger/logger.c | 14 +++++++++++++- src/libserver/logger/logger_private.h | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libserver/logger/logger.c b/src/libserver/logger/logger.c index 0c7400ebf..f65d0fb2e 100644 --- a/src/libserver/logger/logger.c +++ b/src/libserver/logger/logger.c @@ -48,11 +48,23 @@ rspamd_log_emergency_logger (void) void rspamd_log_set_log_level (rspamd_logger_t *logger, gint level) { - g_assert (logger != NULL); + if (logger == NULL) { + logger = default_logger; + } logger->log_level = level; } +gint +rspamd_log_get_log_level (rspamd_logger_t *logger) +{ + if (logger == NULL) { + logger = default_logger; + } + + return logger->log_level; +} + void rspamd_log_set_log_flags (rspamd_logger_t *logger, gint flags) { diff --git a/src/libserver/logger/logger_private.h b/src/libserver/logger/logger_private.h index 92bdfdba7..cb06abe7c 100644 --- a/src/libserver/logger/logger_private.h +++ b/src/libserver/logger/logger_private.h @@ -168,7 +168,6 @@ bool rspamd_log_console_log (const gchar *module, const gchar *id, gsize mlen, rspamd_logger_t *rspamd_log, gpointer arg); -const gchar *rspamd_get_log_severity_string(gint level_flags); static const struct rspamd_logger_funcs console_log_funcs = { .init = rspamd_log_console_init, -- 2.39.5