From 27f58d8dc68b77e6ba935dbc3dce8df8cbe5e1a3 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 9 Mar 2018 20:42:27 +0000 Subject: [PATCH] logging: Don't use PrintF when not needed (#1599) These log print don't have any verbs, so just use plain Print --- plugin/cache/cache.go | 2 +- plugin/dnssec/responsewriter.go | 2 +- plugin/dnstap/dnstapio/io.go | 6 +++--- plugin/file/notify.go | 2 +- plugin/kubernetes/apiproxy.go | 2 +- plugin/loadbalance/loadbalance.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugin/cache/cache.go b/plugin/cache/cache.go index a8776afac..fd3292b47 100644 --- a/plugin/cache/cache.go +++ b/plugin/cache/cache.go @@ -177,7 +177,7 @@ func (w *ResponseWriter) set(m *dns.Msg, key int, mt response.Type, duration tim // Write implements the dns.ResponseWriter interface. func (w *ResponseWriter) Write(buf []byte) (int, error) { - log.Printf("[WARNING] Caching called with Write: not caching reply") + log.Print("[WARNING] Caching called with Write: not caching reply") if w.prefetch { return 0, nil } diff --git a/plugin/dnssec/responsewriter.go b/plugin/dnssec/responsewriter.go index c50850aba..bf408ecf3 100644 --- a/plugin/dnssec/responsewriter.go +++ b/plugin/dnssec/responsewriter.go @@ -40,7 +40,7 @@ func (d *ResponseWriter) WriteMsg(res *dns.Msg) error { // Write implements the dns.ResponseWriter interface. func (d *ResponseWriter) Write(buf []byte) (int, error) { - log.Printf("[WARNING] Dnssec called with Write: not signing reply") + log.Print("[WARNING] Dnssec called with Write: not signing reply") n, err := d.ResponseWriter.Write(buf) return n, err } diff --git a/plugin/dnstap/dnstapio/io.go b/plugin/dnstap/dnstapio/io.go index 9a0013ba5..57a7302ac 100644 --- a/plugin/dnstap/dnstapio/io.go +++ b/plugin/dnstap/dnstapio/io.go @@ -70,7 +70,7 @@ func (dio *dnstapIO) newConnect() error { // Connect connects to the dnstop endpoint. func (dio *dnstapIO) Connect() { if err := dio.newConnect(); err != nil { - log.Printf("[ERROR] No connection to dnstap endpoint") + log.Print("[ERROR] No connection to dnstap endpoint") } go dio.serve() } @@ -102,7 +102,7 @@ func (dio *dnstapIO) flushBuffer() { if err := dio.newConnect(); err != nil { return } - log.Printf("[INFO] Reconnected to dnstap") + log.Print("[INFO] Reconnected to dnstap") } if err := dio.enc.flushBuffer(); err != nil { @@ -111,7 +111,7 @@ func (dio *dnstapIO) flushBuffer() { if err := dio.newConnect(); err != nil { log.Printf("[ERROR] Cannot connect to dnstap: %s", err) } else { - log.Printf("[INFO] Reconnected to dnstap") + log.Print("[INFO] Reconnected to dnstap") } } } diff --git a/plugin/file/notify.go b/plugin/file/notify.go index 68850e0d3..1d60d20d5 100644 --- a/plugin/file/notify.go +++ b/plugin/file/notify.go @@ -53,7 +53,7 @@ func notify(zone string, to []string) error { continue } if err := notifyAddr(c, m, t); err != nil { - log.Printf("[ERROR] " + err.Error()) + log.Print("[ERROR] " + err.Error()) } else { log.Printf("[INFO] Sent notify for zone %q to %q", zone, t) } diff --git a/plugin/kubernetes/apiproxy.go b/plugin/kubernetes/apiproxy.go index 59a569885..097600096 100644 --- a/plugin/kubernetes/apiproxy.go +++ b/plugin/kubernetes/apiproxy.go @@ -33,7 +33,7 @@ func (p *proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } hj, ok := w.(http.Hijacker) if !ok { - log.Printf("[ERROR] Unable to establish connection: no hijacker") + log.Print("[ERROR] Unable to establish connection: no hijacker") http.Error(w, "Unable to establish connection: no hijacker", 500) return } diff --git a/plugin/loadbalance/loadbalance.go b/plugin/loadbalance/loadbalance.go index 7df0b31c6..a016e40c5 100644 --- a/plugin/loadbalance/loadbalance.go +++ b/plugin/loadbalance/loadbalance.go @@ -75,7 +75,7 @@ func roundRobinShuffle(records []dns.RR) { // Write implements the dns.ResponseWriter interface. func (r *RoundRobinResponseWriter) Write(buf []byte) (int, error) { // Should we pack and unpack here to fiddle with the packet... Not likely. - log.Printf("[WARNING] RoundRobin called with Write: no shuffling records") + log.Print("[WARNING] RoundRobin called with Write: no shuffling records") n, err := r.ResponseWriter.Write(buf) return n, err }