aboutsummaryrefslogtreecommitdiff
path: root/plugin/dnstap
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-04-19 07:41:56 +0100
committerGravatar GitHub <noreply@github.com> 2018-04-19 07:41:56 +0100
commit26d1432ae6c19c91fb6358e7629a9179a85b70f7 (patch)
tree8a9f94cf11dcebf1f079ab478d4ded4bf710c99f /plugin/dnstap
parent2095eb7979f53618180f759d0e68e4070554870d (diff)
downloadcoredns-26d1432ae6c19c91fb6358e7629a9179a85b70f7.tar.gz
coredns-26d1432ae6c19c91fb6358e7629a9179a85b70f7.tar.zst
coredns-26d1432ae6c19c91fb6358e7629a9179a85b70f7.zip
Update all plugins to use plugin/pkg/log (#1694)
* Update all plugins to use plugin/pkg/log I wish this could have been done with sed. Alas manually changed all callers to use the new plugin/pkg/log package. * Error -> Info * Add docs to debug plugin as well
Diffstat (limited to 'plugin/dnstap')
-rw-r--r--plugin/dnstap/dnstapio/io.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugin/dnstap/dnstapio/io.go b/plugin/dnstap/dnstapio/io.go
index 57a7302ac..a6f0442a0 100644
--- a/plugin/dnstap/dnstapio/io.go
+++ b/plugin/dnstap/dnstapio/io.go
@@ -1,11 +1,12 @@
package dnstapio
import (
- "log"
"net"
"sync/atomic"
"time"
+ "github.com/coredns/coredns/plugin/pkg/log"
+
tap "github.com/dnstap/golang-dnstap"
fs "github.com/farsightsec/golang-framestream"
)
@@ -70,7 +71,7 @@ func (dio *dnstapIO) newConnect() error {
// Connect connects to the dnstop endpoint.
func (dio *dnstapIO) Connect() {
if err := dio.newConnect(); err != nil {
- log.Print("[ERROR] No connection to dnstap endpoint")
+ log.Error("No connection to dnstap endpoint")
}
go dio.serve()
}
@@ -102,16 +103,16 @@ func (dio *dnstapIO) flushBuffer() {
if err := dio.newConnect(); err != nil {
return
}
- log.Print("[INFO] Reconnected to dnstap")
+ log.Info("Reconnected to dnstap")
}
if err := dio.enc.flushBuffer(); err != nil {
- log.Printf("[WARN] Connection lost: %s", err)
+ log.Warningf("Connection lost: %s", err)
dio.closeConnection()
if err := dio.newConnect(); err != nil {
- log.Printf("[ERROR] Cannot connect to dnstap: %s", err)
+ log.Errorf("Cannot connect to dnstap: %s", err)
} else {
- log.Print("[INFO] Reconnected to dnstap")
+ log.Info("Reconnected to dnstap")
}
}
}
@@ -134,7 +135,7 @@ func (dio *dnstapIO) serve() {
dio.write(&payload)
case <-timeout:
if dropped := atomic.SwapUint32(&dio.dropped, 0); dropped > 0 {
- log.Printf("[WARN] Dropped dnstap messages: %d", dropped)
+ log.Warningf("Dropped dnstap messages: %d", dropped)
}
dio.flushBuffer()
timeout = time.After(flushTimeout)