From fb7f8ec3fdb69813e96c1951cda5169d9b1d3f6e Mon Sep 17 00:00:00 2001 From: Jan Broer Date: Tue, 22 Dec 2015 00:08:51 +0100 Subject: [PATCH] * Log infolog() messages in default verbosity mode (without -v flag) * Change some verbose logging calls from infolog to vinfolog --- pdns/dnsdist-carbon.cc | 2 +- pdns/dnsdist-web.cc | 2 +- pdns/dnsrulactions.hh | 2 +- pdns/dolog.hh | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pdns/dnsdist-carbon.cc b/pdns/dnsdist-carbon.cc index a5130ec15..ca6274eb2 100644 --- a/pdns/dnsdist-carbon.cc +++ b/pdns/dnsdist-carbon.cc @@ -80,7 +80,7 @@ try int ret = waitForRWData(s.getHandle(), false, 1 , 0); if(ret <= 0 ) { - infolog("Unable to write data to carbon server on %s: %s", localCarbon->server.toStringWithPort(), (ret<0 ? strerror(errno) : "Timeout")); + vinfolog("Unable to write data to carbon server on %s: %s", localCarbon->server.toStringWithPort(), (ret<0 ? strerror(errno) : "Timeout")); continue; } s.setBlocking(); diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index 72ee3d06b..ffef89bcc 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -38,7 +38,7 @@ bool compareAuthorization(YaHTTP::Request& req, const string &expected_password) static void connectionThread(int sock, ComboAddress remote, string password) { using namespace json11; - infolog("Webserver handling connection from %s", remote.toStringWithPort()); + vinfolog("Webserver handling connection from %s", remote.toStringWithPort()); FILE* fp=0; fp=fdopen(sock, "r"); try { diff --git a/pdns/dnsrulactions.hh b/pdns/dnsrulactions.hh index 21fe32ea4..d23cf843f 100644 --- a/pdns/dnsrulactions.hh +++ b/pdns/dnsrulactions.hh @@ -429,7 +429,7 @@ public: DNSAction::Action operator()(const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh, uint16_t& len, string* ruleresult) const override { if(!d_fp) - infolog("Packet from %s for %s %s with id %d", remote.toStringWithPort(), qname.toString(), QType(qtype).getName(), dh->id); + vinfolog("Packet from %s for %s %s with id %d", remote.toStringWithPort(), qname.toString(), QType(qtype).getName(), dh->id); else { string out = qname.toDNSString(); fwrite(out.c_str(), 1, out.size(), d_fp); diff --git a/pdns/dolog.hh b/pdns/dolog.hh index a7eea0b4d..eb988232e 100644 --- a/pdns/dolog.hh +++ b/pdns/dolog.hh @@ -10,12 +10,13 @@ Usage: string address="localhost"; + vinfolog("Got TCP connection from %s", remote); infolog("Bound to %s port %d", address, port); warnlog("Query took %d milliseconds", 1232.4); // yes, %d errlog("Unable to bind to %s: %s", ca.toStringWithPort(), strerr(errno)); If bool g_console is true, will log to stdout. Will syslog in any case with LOG_INFO, - LOG_WARNING, LOG_ERR respectively. If g_verbose=false, infolog is a noop. + LOG_WARNING, LOG_ERR respectively. If g_verbose=false, vinfolog is a noop. More generically, dolog(someiostream, "Hello %s", stream) will log to someiostream This will happily print a string to %d! Doesn't do further format processing. @@ -64,8 +65,7 @@ void genlog(int level, const char* s, Args... args) template void infolog(const char* s, Args... args) { - if(g_verbose) - genlog(LOG_INFO, s, args...); + genlog(LOG_INFO, s, args...); } template -- 2.40.0