]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Preserve debug logging when running `rspamadm -v`
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Mar 2019 14:03:30 +0000 (14:03 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Mar 2019 14:03:30 +0000 (14:03 +0000)
src/libserver/cfg_file.h
src/libutil/logger.c
src/rspamadm/rspamadm.c

index 5b9e89c6c8947f633594b24f362c6c9aeba4251b..fc61eae6be4d54d949b796cab56e96e6cdc57671 100644 (file)
@@ -71,6 +71,7 @@ enum rspamd_log_cfg_flags {
        RSPAMD_LOG_FLAG_RE_CACHE = (1 << 2),
        RSPAMD_LOG_FLAG_USEC = (1 << 3),
        RSPAMD_LOG_FLAG_RSPAMADM = (1 << 4),
+       RSPAMD_LOG_FLAG_ENFORCED = (1 << 5),
 };
 
 struct rspamd_worker_log_pipe {
index 7eb00f3fa12a140105b854228341aec0666ec180..8238886dab6dcaf7b8924285a28d450b352c8cd9 100644 (file)
@@ -459,7 +459,11 @@ rspamd_set_logger (struct rspamd_config *cfg,
 
        logger->log_type = cfg->log_type;
        logger->log_facility = cfg->log_facility;
-       logger->log_level = cfg->log_level;
+
+       if (!(logger->flags & RSPAMD_LOG_FLAG_ENFORCED)) {
+               logger->log_level = cfg->log_level;
+       }
+
        logger->log_buffered = cfg->log_buffered;
        logger->log_silent_workers = cfg->log_silent_workers;
        logger->log_buf_size = cfg->log_buf_size;
index c49853ef7e5ae64e40c7a3c0d636a638b97940de..0c6ffd419993ce6bfce6850f677ecb8a7647ba14 100644 (file)
@@ -420,7 +420,7 @@ main (gint argc, gchar **argv, gchar **env)
        /* Setup logger */
        if (verbose) {
                cfg->log_level = G_LOG_LEVEL_DEBUG;
-               cfg->log_flags |= RSPAMD_LOG_FLAG_USEC;
+               cfg->log_flags |= RSPAMD_LOG_FLAG_USEC|RSPAMD_LOG_FLAG_ENFORCED;
        }
        else {
                cfg->log_level = G_LOG_LEVEL_MESSAGE;