From: Remi Gacogne Date: Tue, 23 Dec 2025 15:36:23 +0000 (+0100) Subject: dnsdist: Convert top-levels errors to structured logging X-Git-Tag: rec-5.4.0-beta1~33^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f22952ba8b8e5760cd8d8b462a37d76f213264a0;p=thirdparty%2Fpdns.git dnsdist: Convert top-levels errors to structured logging Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist.cc b/pdns/dnsdistdist/dnsdist.cc index f820290d5e..1bee806eac 100644 --- a/pdns/dnsdistdist/dnsdist.cc +++ b/pdns/dnsdistdist/dnsdist.cc @@ -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); } }