From: Otto Moerbeek Date: Wed, 22 Jun 2022 10:09:50 +0000 (+0200) Subject: Only create logging object for DNSSEC logging if needed later X-Git-Tag: auth-4.8.0-alpha0~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a8a91bbba380dd6185bf693026f835e498d993;p=thirdparty%2Fpdns.git Only create logging object for DNSSEC logging if needed later --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index e12849d9da..623452f7fa 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1258,12 +1258,13 @@ void startDoResolve(void* p) auto state = sr.getValidationState(); string x_marker; - auto log = sr.d_slog; + std::shared_ptr log; if (sr.doLog() || vStateIsBogus(state)) { - log = log->withValues("vstate", Logging::Loggable(state)); + // Only create logging object if needed below, beware if you change the logging logic! + log = sr.d_slog->withValues("vstate", Logging::Loggable(state)); auto xdnssec = g_xdnssec.getLocal(); if (xdnssec->check(dc->d_mdp.d_qname)) { - log = log->withValues("in-x-dnssec-names", Logging::Loggable("1")); + log = log->withValues("in-x-dnssec-names", Logging::Loggable(1)); x_marker = " [in x-dnssec-names]"; } }