commit 4341e84: [Minor] Allow to get logger level
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Aug 24 09:49:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-08-24 10:40:56 +0100
URL: https://github.com/rspamd/rspamd/commit/4341e843322919ea4aab895f03e1897fcb86d789
[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,
More information about the Commits
mailing list