From e80e881335f1970588e09e140efe4d61f5b4b548 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Wed, 3 Dec 2025 10:36:55 -0500 Subject: [PATCH] main/options: display level name, not numeric Issue: 7389 Follow-up change for verbose handling. Instead of displaying the numeric verbose level, display the level name. I.e., instead of 4, display Debug --- src/suricata.c | 4 +++- src/util-debug.c | 5 +++++ src/util-debug.h | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/suricata.c b/src/suricata.c index d5d325c201..95cd773edf 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -121,6 +121,7 @@ #include "util-device-private.h" #include "util-dpdk.h" #include "util-ebpf.h" +#include "util-enum.h" #include "util-exception-policy.h" #include "util-host-os-info.h" #include "util-hugepages.h" @@ -3066,7 +3067,8 @@ void SuricataInit(void) SCLogInfo("Running suricata under test mode"); if (suricata.verbose) { - SCLogInfo("Running with verbose level %d", suricata.verbose); + SCLogInfo( + "Running with verbose level %s", SCLogLevel2Name(suricata.verbose + SC_LOG_NOTICE)); } if (ParseInterfacesList(suricata.aux_run_mode, suricata.pcap_dev) != TM_ECODE_OK) { diff --git a/src/util-debug.c b/src/util-debug.c index 1477a7e032..639de02a1b 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -1068,6 +1068,11 @@ static inline void SCLogSetLogLevel(SCLogInitData *sc_lid, SCLogConfig *sc_lc) sc_log_global_log_level = sc_lc->log_level; } +const char *SCLogLevel2Name(const SCLogLevel lvl) +{ + return SCMapEnumValueToName(lvl, sc_log_level_map); +} + SCLogLevel SCLogGetLogLevel(void) { return sc_log_global_log_level; diff --git a/src/util-debug.h b/src/util-debug.h index 791388a302..9fad5cd407 100644 --- a/src/util-debug.h +++ b/src/util-debug.h @@ -25,6 +25,7 @@ #define SURICATA_UTIL_DEBUG_H #include "util-error.h" +#include "util-enum.h" /** * \brief The various log levels @@ -44,6 +45,8 @@ typedef enum { SC_LOG_LEVEL_MAX, } SCLogLevel; +extern const char *SCLogLevel2Name(const SCLogLevel lvl); + SCError SCLogMessage(const SCLogLevel, const char *, const unsigned int, const char *, const char *, const char *message);