diff options
author | 2021-07-09 16:23:02 +0200 | |
---|---|---|
committer | 2021-07-09 14:23:02 +0000 | |
commit | 70b51a73d3a0029394dbdbc9f52a4d3d8e89d6f5 (patch) | |
tree | 9bd9362cdda53be3d3e56b4a76a59b8331b5ef21 /plugin/errors/errors.go | |
parent | a6a7e738136cf09950dcdf880fe12ea9e14e3afc (diff) | |
download | coredns-70b51a73d3a0029394dbdbc9f52a4d3d8e89d6f5.tar.gz coredns-70b51a73d3a0029394dbdbc9f52a4d3d8e89d6f5.tar.zst coredns-70b51a73d3a0029394dbdbc9f52a4d3d8e89d6f5.zip |
add configurable log level to errors plugin (#4718)
Automatically submitted.
Diffstat (limited to 'plugin/errors/errors.go')
-rw-r--r-- | plugin/errors/errors.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugin/errors/errors.go b/plugin/errors/errors.go index 9565f11ab..c045f6992 100644 --- a/plugin/errors/errors.go +++ b/plugin/errors/errors.go @@ -18,10 +18,11 @@ import ( var log = clog.NewWithPlugin("errors") type pattern struct { - ptimer unsafe.Pointer - count uint32 - period time.Duration - pattern *regexp.Regexp + ptimer unsafe.Pointer + count uint32 + period time.Duration + pattern *regexp.Regexp + logCallback func(format string, v ...interface{}) } func (p *pattern) timer() *time.Timer { @@ -46,7 +47,7 @@ func newErrorHandler() *errorHandler { func (h *errorHandler) logPattern(i int) { cnt := atomic.SwapUint32(&h.patterns[i].count, 0) if cnt > 0 { - log.Errorf("%d errors like '%s' occurred in last %s", + h.patterns[i].logCallback("%d errors like '%s' occurred in last %s", cnt, h.patterns[i].pattern.String(), h.patterns[i].period) } } |