From 94c51ae540723f5f648477789c11f6395730ae05 Mon Sep 17 00:00:00 2001 From: stickies-v Date: Tue, 9 Dec 2025 11:37:42 +0000 Subject: [PATCH] libevent: separate log statements per level Avoids ratelimiting unconditional log statements when debug logging is enabled. Introduces slight behaviour change by removing the category from unconditional logs, making them more uniform with the other unconditional logs in the codebase. Also, in a slight behavior change, prefix the info-level (and higher) messages with "libevent:". --- src/httpserver.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index abfcb455e14..6cf47eba736 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -422,22 +422,20 @@ static void HTTPWorkQueueRun(WorkQueue* queue, int worker_num) /** libevent event log callback */ static void libevent_log_cb(int severity, const char *msg) { - BCLog::Level level; switch (severity) { case EVENT_LOG_DEBUG: - level = BCLog::Level::Debug; + LogDebug(BCLog::LIBEVENT, "%s", msg); break; case EVENT_LOG_MSG: - level = BCLog::Level::Info; + LogInfo("libevent: %s", msg); break; case EVENT_LOG_WARN: - level = BCLog::Level::Warning; + LogWarning("libevent: %s", msg); break; default: // EVENT_LOG_ERR and others are mapped to error - level = BCLog::Level::Error; + LogError("libevent: %s", msg); break; } - LogPrintLevel(BCLog::LIBEVENT, level, "%s\n", msg); } bool InitHTTPServer(const util::SignalInterrupt& interrupt)