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:".
This commit is contained in:
stickies-v
2025-12-09 11:37:42 +00:00
committed by MarcoFalke
parent fa89f60e31
commit 94c51ae540

View File

@@ -422,22 +422,20 @@ static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* 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)