mirror of
https://github.com/coredns/coredns.git
synced 2025-11-13 23:42:40 -05:00
plugin/trace: make zipkin and datadog reporters log errors using CoreDNS logger (#5452)
This commit is contained in:
20
plugin/trace/logger.go
Normal file
20
plugin/trace/logger.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package trace
|
||||
|
||||
import (
|
||||
clog "github.com/coredns/coredns/plugin/pkg/log"
|
||||
)
|
||||
|
||||
// loggerAdapter is a simple adapter around plugin logger made to implement io.Writer and ddtrace.Logger interface
|
||||
// in order to log errors from span reporters as warnings
|
||||
type loggerAdapter struct {
|
||||
clog.P
|
||||
}
|
||||
|
||||
func (l *loggerAdapter) Write(p []byte) (n int, err error) {
|
||||
l.P.Warning(string(p))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (l *loggerAdapter) Log(msg string) {
|
||||
l.P.Warning(msg)
|
||||
}
|
||||
Reference in New Issue
Block a user