diff options
Diffstat (limited to 'plugin')
36 files changed, 177 insertions, 0 deletions
diff --git a/plugin/auto/log_test.go b/plugin/auto/log_test.go new file mode 100644 index 000000000..6047eebda --- /dev/null +++ b/plugin/auto/log_test.go @@ -0,0 +1,5 @@ +package auto + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/bind/log_test.go b/plugin/bind/log_test.go new file mode 100644 index 000000000..4ee3ffcca --- /dev/null +++ b/plugin/bind/log_test.go @@ -0,0 +1,5 @@ +package bind + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/cache/log_test.go b/plugin/cache/log_test.go new file mode 100644 index 000000000..220b2068a --- /dev/null +++ b/plugin/cache/log_test.go @@ -0,0 +1,5 @@ +package cache + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/chaos/log_test.go b/plugin/chaos/log_test.go new file mode 100644 index 000000000..92c98af69 --- /dev/null +++ b/plugin/chaos/log_test.go @@ -0,0 +1,5 @@ +package chaos + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/debug/log_test.go b/plugin/debug/log_test.go new file mode 100644 index 000000000..6e256db37 --- /dev/null +++ b/plugin/debug/log_test.go @@ -0,0 +1,5 @@ +package debug + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnssec/log_test.go b/plugin/dnssec/log_test.go new file mode 100644 index 000000000..e8f3a1ddc --- /dev/null +++ b/plugin/dnssec/log_test.go @@ -0,0 +1,5 @@ +package dnssec + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnstap/dnstapio/log_test.go b/plugin/dnstap/dnstapio/log_test.go new file mode 100644 index 000000000..c37b3df73 --- /dev/null +++ b/plugin/dnstap/dnstapio/log_test.go @@ -0,0 +1,5 @@ +package dnstapio + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnstap/log_test.go b/plugin/dnstap/log_test.go new file mode 100644 index 000000000..145aa1db2 --- /dev/null +++ b/plugin/dnstap/log_test.go @@ -0,0 +1,5 @@ +package dnstap + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/erratic/log_test.go b/plugin/erratic/log_test.go new file mode 100644 index 000000000..f6fb4bff4 --- /dev/null +++ b/plugin/erratic/log_test.go @@ -0,0 +1,5 @@ +package erratic + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/errors/log_test.go b/plugin/errors/log_test.go new file mode 100644 index 000000000..643c16a2d --- /dev/null +++ b/plugin/errors/log_test.go @@ -0,0 +1,5 @@ +package errors + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/etcd/log_test.go b/plugin/etcd/log_test.go new file mode 100644 index 000000000..57735be09 --- /dev/null +++ b/plugin/etcd/log_test.go @@ -0,0 +1,5 @@ +package etcd + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/federation/log_test.go b/plugin/federation/log_test.go new file mode 100644 index 000000000..fa9481726 --- /dev/null +++ b/plugin/federation/log_test.go @@ -0,0 +1,5 @@ +package federation + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/file/log_test.go b/plugin/file/log_test.go new file mode 100644 index 000000000..c9609eecf --- /dev/null +++ b/plugin/file/log_test.go @@ -0,0 +1,5 @@ +package file + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/forward/log_test.go b/plugin/forward/log_test.go new file mode 100644 index 000000000..a7f0a8589 --- /dev/null +++ b/plugin/forward/log_test.go @@ -0,0 +1,5 @@ +package forward + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/health/log_test.go b/plugin/health/log_test.go new file mode 100644 index 000000000..7e6c97bc4 --- /dev/null +++ b/plugin/health/log_test.go @@ -0,0 +1,5 @@ +package health + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/hosts/log_test.go b/plugin/hosts/log_test.go new file mode 100644 index 000000000..e784bd6ee --- /dev/null +++ b/plugin/hosts/log_test.go @@ -0,0 +1,5 @@ +package hosts + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/kubernetes/log_test.go b/plugin/kubernetes/log_test.go new file mode 100644 index 000000000..b8b7b7473 --- /dev/null +++ b/plugin/kubernetes/log_test.go @@ -0,0 +1,5 @@ +package kubernetes + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/loadbalance/log_test.go b/plugin/loadbalance/log_test.go new file mode 100644 index 000000000..e4dbd6de1 --- /dev/null +++ b/plugin/loadbalance/log_test.go @@ -0,0 +1,5 @@ +package loadbalance + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/log/log_test.go b/plugin/log/log_test.go index 484135cd5..d1ff8d36d 100644 --- a/plugin/log/log_test.go +++ b/plugin/log/log_test.go @@ -8,12 +8,15 @@ import ( "testing" "github.com/coredns/coredns/plugin/pkg/dnstest" + clog "github.com/coredns/coredns/plugin/pkg/log" "github.com/coredns/coredns/plugin/pkg/response" "github.com/coredns/coredns/plugin/test" "github.com/miekg/dns" ) +func init() { clog.Discard() } + func TestLoggedStatus(t *testing.T) { var f bytes.Buffer rule := Rule{ diff --git a/plugin/log_test.go b/plugin/log_test.go new file mode 100644 index 000000000..0ee4b7c6c --- /dev/null +++ b/plugin/log_test.go @@ -0,0 +1,5 @@ +package plugin + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/metadata/log_test.go b/plugin/metadata/log_test.go new file mode 100644 index 000000000..8d1e9249d --- /dev/null +++ b/plugin/metadata/log_test.go @@ -0,0 +1,5 @@ +package metadata + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/metrics/log_test.go b/plugin/metrics/log_test.go new file mode 100644 index 000000000..101098a8c --- /dev/null +++ b/plugin/metrics/log_test.go @@ -0,0 +1,5 @@ +package metrics + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/nsid/log_test.go b/plugin/nsid/log_test.go new file mode 100644 index 000000000..1aea37906 --- /dev/null +++ b/plugin/nsid/log_test.go @@ -0,0 +1,5 @@ +package nsid + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } 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] " diff --git a/plugin/pprof/log_test.go b/plugin/pprof/log_test.go new file mode 100644 index 000000000..7e2c25234 --- /dev/null +++ b/plugin/pprof/log_test.go @@ -0,0 +1,5 @@ +package pprof + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/proxy/log_test.go b/plugin/proxy/log_test.go new file mode 100644 index 000000000..e0c50773b --- /dev/null +++ b/plugin/proxy/log_test.go @@ -0,0 +1,5 @@ +package proxy + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/reload/log_test.go b/plugin/reload/log_test.go new file mode 100644 index 000000000..2f6598dea --- /dev/null +++ b/plugin/reload/log_test.go @@ -0,0 +1,5 @@ +package reload + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/rewrite/log_test.go b/plugin/rewrite/log_test.go new file mode 100644 index 000000000..6ce362746 --- /dev/null +++ b/plugin/rewrite/log_test.go @@ -0,0 +1,5 @@ +package rewrite + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/root/log_test.go b/plugin/root/log_test.go new file mode 100644 index 000000000..f63caac29 --- /dev/null +++ b/plugin/root/log_test.go @@ -0,0 +1,5 @@ +package root + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/route53/log_test.go b/plugin/route53/log_test.go new file mode 100644 index 000000000..20d1f87bd --- /dev/null +++ b/plugin/route53/log_test.go @@ -0,0 +1,5 @@ +package route53 + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/secondary/log_test.go b/plugin/secondary/log_test.go new file mode 100644 index 000000000..15cab004f --- /dev/null +++ b/plugin/secondary/log_test.go @@ -0,0 +1,5 @@ +package secondary + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/template/log_test.go b/plugin/template/log_test.go new file mode 100644 index 000000000..13d6e6b28 --- /dev/null +++ b/plugin/template/log_test.go @@ -0,0 +1,5 @@ +package template + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/tls/log_test.go b/plugin/tls/log_test.go new file mode 100644 index 000000000..017affd09 --- /dev/null +++ b/plugin/tls/log_test.go @@ -0,0 +1,5 @@ +package tls + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/trace/log_test.go b/plugin/trace/log_test.go new file mode 100644 index 000000000..a0fe76142 --- /dev/null +++ b/plugin/trace/log_test.go @@ -0,0 +1,5 @@ +package trace + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/whoami/log_test.go b/plugin/whoami/log_test.go new file mode 100644 index 000000000..460c11cd2 --- /dev/null +++ b/plugin/whoami/log_test.go @@ -0,0 +1,5 @@ +package whoami + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } |