mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[logger] Always limit repeated logging no matter the log level
This commit is contained in:
parent
4fa7eb98a0
commit
87cb3b8b58
@ -38,7 +38,7 @@
|
|||||||
#include "conffile.h"
|
#include "conffile.h"
|
||||||
#include "misc.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 */
|
/* We need our own check to avoid nested locking or recursive calls */
|
||||||
#define LOGGER_CHECK_ERR(f) \
|
#define LOGGER_CHECK_ERR(f) \
|
||||||
@ -53,7 +53,7 @@ static int logger_initialized;
|
|||||||
static int logdomains;
|
static int logdomains;
|
||||||
static int threshold;
|
static int threshold;
|
||||||
static int console = 1;
|
static int console = 1;
|
||||||
static int logger_repeat_counter;
|
static uint32_t logger_repeat_counter;
|
||||||
static uint32_t logger_last_hash;
|
static uint32_t logger_last_hash;
|
||||||
static char *logfilename;
|
static char *logfilename;
|
||||||
static FILE *logfile;
|
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");
|
strcpy(content, "(LOGGING SKIPPED - invalid content)\n");
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
// On debug and spam levels we don't suppress repeating log messages
|
|
||||||
if (severity < E_DBG)
|
|
||||||
{
|
|
||||||
ret = repeat_count(content);
|
ret = repeat_count(content);
|
||||||
if (ret == LOGGER_REPEAT_MAX)
|
if (ret == LOGGER_REPEAT_MAX)
|
||||||
strcpy(content, "(LOGGING SKIPPED - above log message is repeating)\n");
|
strcpy(content, "(LOGGING SKIPPED - above log message is repeating)\n");
|
||||||
else if (ret > LOGGER_REPEAT_MAX)
|
else if (ret > LOGGER_REPEAT_MAX)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (logfile)
|
if (logfile)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user