diff options
author | 2019-03-07 23:14:09 +0300 | |
---|---|---|
committer | 2019-03-07 20:14:09 +0000 | |
commit | 18d305f4b3eaf398215fa704b681c4778376a8a8 (patch) | |
tree | 255bd72c86edb92bc163dae8da483e87d9f15591 /plugin/errors/errors.go | |
parent | 89a4b9bd45aa34a00e5cb6c55800736ca8a4e6e9 (diff) | |
download | coredns-18d305f4b3eaf398215fa704b681c4778376a8a8.tar.gz coredns-18d305f4b3eaf398215fa704b681c4778376a8a8.tar.zst coredns-18d305f4b3eaf398215fa704b681c4778376a8a8.zip |
plugin/errors: remove cLogger and eLogger (#2657)
Diffstat (limited to 'plugin/errors/errors.go')
-rw-r--r-- | plugin/errors/errors.go | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/plugin/errors/errors.go b/plugin/errors/errors.go index 168092097..9565f11ab 100644 --- a/plugin/errors/errors.go +++ b/plugin/errors/errors.go @@ -35,28 +35,19 @@ func (p *pattern) setTimer(t *time.Timer) { // errorHandler handles DNS errors (and errors from other plugin). type errorHandler struct { patterns []*pattern - eLogger func(int, string, string, string) - cLogger func(uint32, string, time.Duration) stopFlag uint32 Next plugin.Handler } func newErrorHandler() *errorHandler { - return &errorHandler{eLogger: errorLogger, cLogger: consLogger} -} - -func errorLogger(code int, qName, qType, err string) { - log.Errorf("%d %s %s: %s", code, qName, qType, err) -} - -func consLogger(cnt uint32, pattern string, p time.Duration) { - log.Errorf("%d errors like '%s' occurred in last %s", cnt, pattern, p) + return &errorHandler{} } func (h *errorHandler) logPattern(i int) { cnt := atomic.SwapUint32(&h.patterns[i].count, 0) if cnt > 0 { - h.cLogger(cnt, h.patterns[i].pattern.String(), h.patterns[i].period) + log.Errorf("%d errors like '%s' occurred in last %s", + cnt, h.patterns[i].pattern.String(), h.patterns[i].period) } } @@ -102,7 +93,7 @@ func (h *errorHandler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dn } } state := request.Request{W: w, Req: r} - h.eLogger(rcode, state.Name(), state.Type(), strErr) + log.Errorf("%d %s %s: %s", rcode, state.Name(), state.Type(), strErr) } return rcode, err |