]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Convert top-levels errors to structured logging
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 23 Dec 2025 15:36:23 +0000 (16:36 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Jan 2026 10:00:57 +0000 (11:00 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist.cc

index f820290d5e4ce9ec869a42987b97b7872016e0f7..1bee806eac1104dffcb0196082cb202658934f4d 100644 (file)
@@ -3924,23 +3924,28 @@ int main(int argc, char** argv)
   }
   catch (const LuaContext::ExecutionErrorException& e) {
     try {
-      errlog("Fatal Lua error: %s", e.what());
+      SLOG(errlog("Fatal Lua error: %s", e.what()),
+           dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Fatal Lua error"));
       std::rethrow_if_nested(e);
     }
     catch (const std::exception& ne) {
-      errlog("Details: %s", ne.what());
+      SLOG(errlog("Details: %s", ne.what()),
+           dnsdist::logging::getTopLogger()->error(Logr::Error, ne.what(), "Additional details for fatal Lua error"));
     }
     catch (const PDNSException& ae) {
-      errlog("Fatal pdns error: %s", ae.reason);
+      SLOG(errlog("Fatal pdns error: %s", ae.reason),
+           dnsdist::logging::getTopLogger()->error(Logr::Error, ae.reason, "Additional PowerDNS details for fatal Lua error"));
     }
     doExitNicely(EXIT_FAILURE);
   }
   catch (const std::exception& e) {
-    errlog("Fatal error: %s", e.what());
+    SLOG(errlog("Fatal error: %s", e.what()),
+         dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Fatal error"));
     doExitNicely(EXIT_FAILURE);
   }
   catch (const PDNSException& ae) {
-    errlog("Fatal pdns error: %s", ae.reason);
+    SLOG(errlog("Fatal pdns error: %s", ae.reason),
+         dnsdist::logging::getTopLogger()->error(Logr::Error, ae.reason, "Fatal PowerDNS error"));
     doExitNicely(EXIT_FAILURE);
   }
 }