From ee6c39b985b82c8d27274ec5ba0d676ba8e63ed5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 6 Jan 2023 14:50:34 +0100 Subject: [PATCH] output: improve debug format by adding function name --- src/util-debug.c | 10 +++++----- src/util-debug.h | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/util-debug.c b/src/util-debug.c index 60f67bac45..2cecc4d4c5 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -1085,13 +1085,13 @@ static inline const char *SCLogGetDefaultLogFormat(const SCLogLevel lvl) const char *prog_ver = GetProgramVersion(); if (strstr(prog_ver, "RELEASE") != NULL) { if (lvl <= SC_LOG_NOTICE) - return SC_LOG_DEF_LOG_FORMAT_REL; + return SC_LOG_DEF_LOG_FORMAT_REL_NOTICE; else if (lvl <= SC_LOG_INFO) - return SC_LOG_DEF_LOG_FORMAT_RELV; - else if (lvl <= SC_LOG_PERF) - return SC_LOG_DEF_LOG_FORMAT_RELVV; + return SC_LOG_DEF_LOG_FORMAT_REL_INFO; + else if (lvl <= SC_LOG_CONFIG) + return SC_LOG_DEF_LOG_FORMAT_REL_CONFIG; } - return SC_LOG_DEF_LOG_FORMAT_DEV; + return SC_LOG_DEF_LOG_FORMAT_DEBUG; } /** diff --git a/src/util-debug.h b/src/util-debug.h index 167f9c2fa0..808cc8a5a0 100644 --- a/src/util-debug.h +++ b/src/util-debug.h @@ -75,14 +75,10 @@ typedef enum { /* The default log_format, if it is not supplied by the user */ #define SC_LOG_DEF_FILE_FORMAT "[%i - %m] %z %d: %S: %M" -#define SC_LOG_DEF_LOG_FORMAT_REL "%D: %S: %M" -#define SC_LOG_DEF_LOG_FORMAT_RELV "%d: %S: %M" -#define SC_LOG_DEF_LOG_FORMAT_RELVV "[%i] %d: %S: %M" -#ifdef DEBUG -#define SC_LOG_DEF_LOG_FORMAT_DEV "%d: %S: %M [%f:%l]" -#else -#define SC_LOG_DEF_LOG_FORMAT_DEV "%d: %S: %M [%f:%l]" -#endif +#define SC_LOG_DEF_LOG_FORMAT_REL_NOTICE "%D: %S: %M" +#define SC_LOG_DEF_LOG_FORMAT_REL_INFO "%d: %S: %M" +#define SC_LOG_DEF_LOG_FORMAT_REL_CONFIG "[%i] %d: %S: %M" +#define SC_LOG_DEF_LOG_FORMAT_DEBUG "(%n) %d: %S: %M [%f:%l]" /* The maximum length of the log message */ #define SC_LOG_MAX_LOG_MSG_LEN 2048