Skip to content

Commit 938702e

Browse files
committed
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.
1 parent fa89f60 commit 938702e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/httpserver.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,22 +422,20 @@ static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue, int worker_num)
422422
/** libevent event log callback */
423423
static void libevent_log_cb(int severity, const char *msg)
424424
{
425-
BCLog::Level level;
426425
switch (severity) {
427426
case EVENT_LOG_DEBUG:
428-
level = BCLog::Level::Debug;
427+
LogDebug(BCLog::LIBEVENT, "%s", msg);
429428
break;
430429
case EVENT_LOG_MSG:
431-
level = BCLog::Level::Info;
430+
LogInfo("%s", msg);
432431
break;
433432
case EVENT_LOG_WARN:
434-
level = BCLog::Level::Warning;
433+
LogWarning("%s", msg);
435434
break;
436435
default: // EVENT_LOG_ERR and others are mapped to error
437-
level = BCLog::Level::Error;
436+
LogError("%s", msg);
438437
break;
439438
}
440-
LogPrintLevel(BCLog::LIBEVENT, level, "%s\n", msg);
441439
}
442440

443441
bool InitHTTPServer(const util::SignalInterrupt& interrupt)

0 commit comments

Comments
 (0)