From 874a9986971e0efe27eaec92c523d563dfa8d1f7 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 10 May 2018 03:04:46 +0100 Subject: plugin/errors: remove panic/recover (#1777) Remove panic/recover and also use pkg/log to print the error. This brings some consistency into the logging. Fixes #1776 --- plugin/errors/errors_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugin/errors/errors_test.go') diff --git a/plugin/errors/errors_test.go b/plugin/errors/errors_test.go index f3857df56..afe809c71 100644 --- a/plugin/errors/errors_test.go +++ b/plugin/errors/errors_test.go @@ -18,7 +18,8 @@ import ( func TestErrors(t *testing.T) { buf := bytes.Buffer{} - em := errorHandler{Log: log.New(&buf, "", 0)} + log.SetOutput(&buf) + em := errorHandler{} testErr := errors.New("test error") tests := []struct { @@ -36,7 +37,7 @@ func TestErrors(t *testing.T) { { next: genErrorHandler(dns.RcodeNotAuth, testErr), expectedCode: dns.RcodeNotAuth, - expectedLog: fmt.Sprintf("[ERROR %d %s] %v\n", dns.RcodeNotAuth, "example.org. A", testErr), + expectedLog: fmt.Sprintf("[ERROR] %d %s: %v\n", dns.RcodeNotAuth, "example.org. A", testErr), expectedErr: testErr, }, } -- cgit v1.2.3