mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 10:13:14 -05:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user