diff options
Diffstat (limited to 'plugin/pkg')
-rw-r--r-- | plugin/pkg/healthcheck/log_test.go | 5 | ||||
-rw-r--r-- | plugin/pkg/log/log.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/plugin/pkg/healthcheck/log_test.go b/plugin/pkg/healthcheck/log_test.go new file mode 100644 index 000000000..95808771c --- /dev/null +++ b/plugin/pkg/healthcheck/log_test.go @@ -0,0 +1,5 @@ +package healthcheck + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/pkg/log/log.go b/plugin/pkg/log/log.go index 161fbc886..387d7f8e2 100644 --- a/plugin/pkg/log/log.go +++ b/plugin/pkg/log/log.go @@ -10,6 +10,7 @@ package log import ( "fmt" + "io/ioutil" golog "log" ) @@ -61,6 +62,9 @@ func Error(v ...interface{}) { log(err, v...) } // Errorf is equivalent to log.Printf, but prefixed with "[ERROR] ". func Errorf(format string, v ...interface{}) { logf(err, format, v...) } +// Discard sets the log output to /dev/null. +func Discard() { golog.SetOutput(ioutil.Discard) } + const ( debug = "[DEBUG] " err = "[ERROR] " |