]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Only create logging object for DNSSEC logging if needed later
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 22 Jun 2022 10:09:50 +0000 (12:09 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 22 Jun 2022 10:09:50 +0000 (12:09 +0200)
pdns/pdns_recursor.cc

index e12849d9da4843eba2a2677f394118a1912a946d..623452f7fa72dab33f93de177f3594c98b1e935d 100644 (file)
@@ -1258,12 +1258,13 @@ void startDoResolve(void* p)
           auto state = sr.getValidationState();
 
           string x_marker;
-          auto log = sr.d_slog;
+          std::shared_ptr<Logr::Logger> 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]";
             }
           }