From: Otto Moerbeek Date: Tue, 21 Jun 2022 07:35:52 +0000 (+0200) Subject: Process review comments: add comments and braces X-Git-Tag: auth-4.8.0-alpha0~51^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2cff1a09651432decac80c02c65b5e3713ba048c;p=thirdparty%2Fpdns.git Process review comments: add comments and braces --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 78bb749ab4..f3da917d6a 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -887,8 +887,11 @@ static const char* toTimestampStringMilli(const struct timeval& tv, char* buf, s #ifdef HAVE_SYSTEMD static void loggerSDBackend(const Logging::Entry& entry) { + // First map SL priority to syslog's Urgency Logger::Urgency u = entry.d_priority ? Logger::Urgency(entry.d_priority) : Logger::Info; if (u > s_logUrgency) { + // We do not log anything if the Urgency of the message is lower than the requested loglevel. + // Not that lower Urgency means higher number. return; } // We need to keep the string in mem until sd_journal_sendv has ben called @@ -928,8 +931,11 @@ static void loggerBackend(const Logging::Entry& entry) { static thread_local std::stringstream buf; + // First map SL priority to syslog's Urgency Logger::Urgency u = entry.d_priority ? Logger::Urgency(entry.d_priority) : Logger::Info; if (u > s_logUrgency) { + // We do not log anything if the Urgency of the message is lower than the requested loglevel. + // Not that lower Urgency means higher number. return; } buf.str(""); @@ -2797,8 +2803,9 @@ int main(int argc, char** argv) g_slogStructured = ::arg().mustDo("structured-logging"); s_structured_logger_backend = ::arg()["structured-logging-backend"]; - if (s_logUrgency < Logger::Error) + if (s_logUrgency < Logger::Error) { s_logUrgency = Logger::Error; + } if (!g_quiet && s_logUrgency < Logger::Info) { // Logger::Info=6, Logger::Debug=7 s_logUrgency = Logger::Info; // if you do --quiet=no, you need Info to also see the query log } @@ -2866,8 +2873,9 @@ int main(int argc, char** argv) s_logUrgency = (Logger::Urgency)::arg().asNum("loglevel"); g_slogStructured = ::arg().mustDo("structured-logging"); - if (s_logUrgency < Logger::Error) + if (s_logUrgency < Logger::Error) { s_logUrgency = Logger::Error; + } if (!g_quiet && s_logUrgency < Logger::Info) { // Logger::Info=6, Logger::Debug=7 s_logUrgency = Logger::Info; // if you do --quiet=no, you need Info to also see the query log }