From: Otto Moerbeek Date: Tue, 17 May 2022 08:43:10 +0000 (+0200) Subject: Formatting X-Git-Tag: auth-4.8.0-alpha0~95^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cb5db5967dc5270e8f7ccfbe3a44f14457a1681;p=thirdparty%2Fpdns.git Formatting --- diff --git a/pdns/logging.hh b/pdns/logging.hh index d2ab31ca58..d8ff96a2d7 100644 --- a/pdns/logging.hh +++ b/pdns/logging.hh @@ -145,6 +145,6 @@ extern bool g_slogStructured; #else // No structured logging (e.g. auth) #define SLOG(oldStyle, slogCall) \ do { \ - oldStyle; \ + oldStyle; \ } while (0); -#endif +#endif // RECURSOR diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 2e3b840d54..55d55f9b03 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -2319,7 +2319,7 @@ void makeUDPServerSockets(deferredAdd_t& deferredAdds, std::shared_ptrinfo(Logr::Warning, "Unable to enable timestamp reporting for socket")); + log->info(Logr::Warning, "Unable to enable timestamp reporting for socket")); } if (IsAnyAddress(sin)) { if (sin.sin4.sin_family == AF_INET) diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 386a695898..862ba00c14 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -85,7 +85,6 @@ static void initArguments(int argc, char** argv) } } - int main(int argc, char** argv) { g_slogStructured = false; diff --git a/pdns/recursordist/logging.cc b/pdns/recursordist/logging.cc index 5b49d2a61e..f6083df59c 100644 --- a/pdns/recursordist/logging.cc +++ b/pdns/recursordist/logging.cc @@ -134,7 +134,8 @@ std::string Loggable>::to_string() const for (const auto& e : _t) { if (!first) { oss << ' '; - } else { + } + else { first = false; } oss << e; diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 28aeefdffd..b00a0af1fc 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -953,8 +953,8 @@ static std::shared_ptr parseACL(const std::string& aclFile, const } SLOG(g_log << Logger::Info << "Done parsing " << result->size() << " " << aclSetting << " ranges from file '" << ::arg()[aclFile] << "' - overriding '" << aclSetting << "' setting" << endl, log->info(Logr::Info, "Done parsing ranges from file, will override setting", "setting", Logging::Loggable(aclSetting), - "number", Logging::Loggable(result->size()), "file", Logging::Loggable(::arg()[aclFile]))); - } + "number", Logging::Loggable(result->size()), "file", Logging::Loggable(::arg()[aclFile]))); + } else if (!::arg()[aclSetting].empty()) { vector ips; stringtok(ips, ::arg()[aclSetting], ", "); @@ -1560,7 +1560,7 @@ static int serviceMain(int argc, char* argv[], std::shared_ptr& lo #ifndef HAVE_DNS_OVER_TLS if (parts.size()) { SLOG(g_log << Logger::Error << "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored." << endl, - log->info(Logr::Error, "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored")); + log->info(Logr::Error, "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored")); } #endif for (const auto& p : parts) { @@ -1716,12 +1716,12 @@ static int serviceMain(int argc, char* argv[], std::shared_ptr& lo if (chroot(::arg()["chroot"].c_str()) < 0 || chdir("/") < 0) { int err = errno; SLOG(g_log << Logger::Error << "Unable to chroot to '" + ::arg()["chroot"] + "': " << strerror(err) << ", exiting" << endl, - log->error(Logr::Error, err, "Unable to chroot", "chroot", Logging::Loggable(::arg()["chroot"]))); + log->error(Logr::Error, err, "Unable to chroot", "chroot", Logging::Loggable(::arg()["chroot"]))); exit(1); } else { SLOG(g_log << Logger::Info << "Chrooted to '" << ::arg()["chroot"] << "'" << endl, - log->info(Logr::Info, "Chrooted", "chroot", Logging::Loggable(::arg()["chroot"]))); + log->info(Logr::Info, "Chrooted", "chroot", Logging::Loggable(::arg()["chroot"]))); } } @@ -1798,7 +1798,7 @@ static int serviceMain(int argc, char* argv[], std::shared_ptr& lo port = std::stoi(part); if (port < 1024 || port > 65535) { SLOG(g_log << Logger::Error << "Unable to launch, udp-source-port-avoid contains an invalid port number: " << part << endl, - log->info(Logr::Error, "Unable to launch, udp-source-port-avoid contains an invalid port number", "port", Logging::Loggable(part))); + log->info(Logr::Error, "Unable to launch, udp-source-port-avoid contains an invalid port number", "port", Logging::Loggable(part))); exit(99); // this isn't going to fix itself either } g_avoidUdpSourcePorts.insert(port); @@ -2680,7 +2680,6 @@ int main(int argc, char** argv) logUrgency = (Logger::Urgency)::arg().asNum("loglevel"); g_slogStructured = ::arg().mustDo("structured-logging"); - if (logUrgency < Logger::Error) logUrgency = Logger::Error; if (!g_quiet && logUrgency < Logger::Info) { // Logger::Info=6, Logger::Debug=7 diff --git a/pdns/recursordist/rec-tcp.cc b/pdns/recursordist/rec-tcp.cc index 96ad132586..f3ae5393ab 100644 --- a/pdns/recursordist/rec-tcp.cc +++ b/pdns/recursordist/rec-tcp.cc @@ -1040,6 +1040,7 @@ void makeTCPServerSockets(deferredAdd_t& deferredAdds, std::set& tcpSockets if (i == locals.begin()) { SLOG(g_log << Logger::Info << "Enabled TCP data-ready filter for (slight) DoS protection" << endl, log->info(Logr::Info, "Enabled TCP data-ready filter for (slight) DoS protection")); + } } #endif diff --git a/pdns/reczones.cc b/pdns/reczones.cc index f50cec976e..bcad1a3414 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -159,7 +159,7 @@ bool primeHints(time_t ignored) } if (SyncRes::s_doIPv4 && SyncRes::s_doIPv6 && !reachableA && !reachableAAAA) { SLOG(g_log << Logger::Error << "No valid root hints" << endl, - log->info(Logr::Error, "No valid root hints")); + log->info(Logr::Error, "No valid root hints")); return false; } } @@ -222,11 +222,11 @@ static void makeNameToIPZone(std::shared_ptr newMap, const if (newMap->count(dr.d_name)) { SLOG(g_log << Logger::Warning << "Hosts file will not overwrite zone '" << dr.d_name << "' already loaded" << endl, - log->info(Logr::Warning, "Hosts file will not overwrite already loaded zone", "zone", Logging::Loggable( dr.d_name))); + log->info(Logr::Warning, "Hosts file will not overwrite already loaded zone", "zone", Logging::Loggable(dr.d_name))); } else { SLOG(g_log << Logger::Warning << "Inserting forward zone '" << dr.d_name << "' based on hosts file" << endl, - log->info(Logr::Warning, "Inserting forward zone based on hosts file", "zone", Logging::Loggable(dr.d_name))); + log->info(Logr::Warning, "Inserting forward zone based on hosts file", "zone", Logging::Loggable(dr.d_name))); ad.d_name = dr.d_name; (*newMap)[ad.d_name] = ad; } @@ -305,9 +305,10 @@ static void convertServersForAD(const std::string& zone, const std::string& inpu g_log << "to: "; bool first = true; for (const auto& a : addresses) { - if (!first ) { + if (!first) { g_log << ", "; - } else { + } + else { first = false; } g_log << a; @@ -330,7 +331,7 @@ string reloadZoneConfiguration() { std::shared_ptr original = SyncRes::getDomainMap(); auto log = g_slog->withName("config"); - + try { SLOG(g_log << Logger::Warning << "Reloading zones, purging data from cache" << endl, log->info(Logr::Warning, "Reloading zones, purging data from cache")); @@ -413,7 +414,7 @@ string reloadZoneConfiguration() } catch (...) { SLOG(g_log << Logger::Error << "Encountered unknown error reloading zones, keeping original data" << endl, - log->error(Logr::Error, "Exception", "Encountered error reloading zones, keeping original data")); + log->error(Logr::Error, "Exception", "Encountered error reloading zones, keeping original data")); } return "reloading failed, see log\n"; } @@ -445,7 +446,7 @@ std::tuple, std::shared_ptr> if (n == 0) { ad.d_rdForward = false; SLOG(g_log << Logger::Error << "Parsing authoritative data for zone '" << headers.first << "' from file '" << headers.second << "'" << endl, - log->info(Logr::Error, "Parsing authoritative data from file", "zone", Logging::Loggable(headers.first), "file", Logging::Loggable(headers.second))); + log->info(Logr::Error, "Parsing authoritative data from file", "zone", Logging::Loggable(headers.first), "file", Logging::Loggable(headers.second))); ZoneParserTNG zpt(headers.second, DNSName(headers.first)); zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps")); zpt.setMaxIncludes(::arg().asNum("max-include-depth")); @@ -478,7 +479,7 @@ std::tuple, std::shared_ptr> if (!::arg()["forward-zones-file"].empty()) { SLOG(g_log << Logger::Warning << "Reading zone forwarding information from '" << ::arg()["forward-zones-file"] << "'" << endl, - log->info(Logr::Warning, "Reading zone forwarding information", "file", Logging::Loggable( ::arg()["forward-zones-file"]))); + log->info(Logr::Warning, "Reading zone forwarding information", "file", Logging::Loggable(::arg()["forward-zones-file"]))); auto fp = std::unique_ptr(fopen(::arg()["forward-zones-file"].c_str(), "r"), fclose); if (!fp) { throw PDNSException("Error opening forward-zones-file '" + ::arg()["forward-zones-file"] + "': " + stringerror()); @@ -536,7 +537,7 @@ std::tuple, std::shared_ptr> } } SLOG(g_log << Logger::Warning << "Done parsing " << newMap->size() - before << " forwarding instructions from file '" << ::arg()["forward-zones-file"] << "'" << endl, - log->info(Logr::Warning, "Done parsing forwarding instructions from file", "file", Logging::Loggable(::arg()["forward-zones-file"]), "count", Logging::Loggable( newMap->size() - before))); + log->info(Logr::Warning, "Done parsing forwarding instructions from file", "file", Logging::Loggable(::arg()["forward-zones-file"]), "count", Logging::Loggable(newMap->size() - before))); } if (::arg().mustDo("export-etc-hosts")) {