mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Clean up tests logging (#1979)
* Clean up tests logging This cleans up the travis logs so you can see the failures better. Older tests in tests/ would call log.SetOutput(ioutil.Discard) in a haphazard way. This add log.Discard and put an `init` function in each package's dir (no way to do this globally). The cleanup in tests/ is clear. All plugins also got this init function to have some uniformity and kill any (future) logging there in the tests as well. There is a one-off in pkg/healthcheck because that does log. Signed-off-by: Miek Gieben <miek@miek.nl> * bring back original log_test.go Signed-off-by: Miek Gieben <miek@miek.nl> * suppress logging here as well Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
5
plugin/pkg/healthcheck/log_test.go
Normal file
5
plugin/pkg/healthcheck/log_test.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package healthcheck
|
||||
|
||||
import clog "github.com/coredns/coredns/plugin/pkg/log"
|
||||
|
||||
func init() { clog.Discard() }
|
||||
@@ -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] "
|
||||
|
||||
Reference in New Issue
Block a user