From 87cb3b8b58252473d7641d831e896e3914249052 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 8 Jan 2020 21:06:38 +0100 Subject: [PATCH] [logger] Always limit repeated logging no matter the log level --- src/logger.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/logger.c b/src/logger.c index 35848c33..776e7094 100644 --- a/src/logger.c +++ b/src/logger.c @@ -38,7 +38,7 @@ #include "conffile.h" #include "misc.h" -#define LOGGER_REPEAT_MAX 15 +#define LOGGER_REPEAT_MAX 5 /* We need our own check to avoid nested locking or recursive calls */ #define LOGGER_CHECK_ERR(f) \ @@ -53,7 +53,7 @@ static int logger_initialized; static int logdomains; static int threshold; static int console = 1; -static int logger_repeat_counter; +static uint32_t logger_repeat_counter; static uint32_t logger_last_hash; static char *logfilename; static FILE *logfile; @@ -125,15 +125,11 @@ vlogger_writer(int severity, int domain, const char *fmt, va_list args) strcpy(content, "(LOGGING SKIPPED - invalid content)\n"); va_end(ap); - // On debug and spam levels we don't suppress repeating log messages - if (severity < E_DBG) - { - ret = repeat_count(content); - if (ret == LOGGER_REPEAT_MAX) - strcpy(content, "(LOGGING SKIPPED - above log message is repeating)\n"); - else if (ret > LOGGER_REPEAT_MAX) - return; - } + ret = repeat_count(content); + if (ret == LOGGER_REPEAT_MAX) + strcpy(content, "(LOGGING SKIPPED - above log message is repeating)\n"); + else if (ret > LOGGER_REPEAT_MAX) + return; if (logfile) {