mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
pkg/log: add Clear to stop debug logging (#3372)
When reloading we need to disable debug output when the debug plugin is removed from the config file. Add a `Clear` function to pkg/log and use it in the server server. Add test case in pkg/log, for actuall check I manually checked the output by sprinkling some debug statements in the startup and checking with sending SIGUSR1. Also clear up the comments in pkg/log to remove the text about time stamping. Fixes: #3035 Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -23,6 +23,13 @@ func TestDebug(t *testing.T) {
|
||||
if x := f.String(); !strings.Contains(x, debug+"debug") {
|
||||
t.Errorf("Expected debug log to be %s, got %s", debug+"debug", x)
|
||||
}
|
||||
f.Reset()
|
||||
|
||||
D.Clear()
|
||||
Debug("debug")
|
||||
if x := f.String(); x != "" {
|
||||
t.Errorf("Expected no debug logs, got %s", x)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugx(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user