From: Jan Broer Date: Mon, 21 Dec 2015 23:08:51 +0000 (+0100) Subject: * Log infolog() messages in default verbosity mode (without -v flag) X-Git-Tag: dnsdist-1.0.0-alpha2~138^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3073%2Fhead;p=thirdparty%2Fpdns.git * Log infolog() messages in default verbosity mode (without -v flag) * Change some verbose logging calls from infolog to vinfolog --- diff --git a/pdns/dnsdist-carbon.cc b/pdns/dnsdist-carbon.cc index a5130ec151..ca6274eb24 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 72ee3d06b0..ffef89bcc7 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 21fe32ea43..d23cf843fc 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 a7eea0b4dc..eb988232ed 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