mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
plugin/error: use warning instead of warn (#4738)
We use the 'WARNING' in the logs, instead of warn, so make the change here as well for consistency sake. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -27,7 +27,7 @@ errors {
|
|||||||
~~~
|
~~~
|
||||||
|
|
||||||
Option `consolidate` allows collecting several error messages matching the regular expression **REGEXP** during **DURATION**. After the **DURATION** since receiving the first such message, the consolidated message will be printed to standard output with
|
Option `consolidate` allows collecting several error messages matching the regular expression **REGEXP** during **DURATION**. After the **DURATION** since receiving the first such message, the consolidated message will be printed to standard output with
|
||||||
log level, which is configurable by optional option **LEVEL**. Supported options for **LEVEL** option are `warn`,`error`,`info` and `debug`.
|
log level, which is configurable by optional option **LEVEL**. Supported options for **LEVEL** option are `warning`,`error`,`info` and `debug`.
|
||||||
~~~
|
~~~
|
||||||
2 errors like '^read udp .* i/o timeout$' occurred in last 30s
|
2 errors like '^read udp .* i/o timeout$' occurred in last 30s
|
||||||
~~~
|
~~~
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func parseLogLevel(c *caddy.Controller, args []string) (func(format string, v ..
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch args[2] {
|
switch args[2] {
|
||||||
case "warn":
|
case "warning":
|
||||||
return log.Warningf, nil
|
return log.Warningf, nil
|
||||||
case "error":
|
case "error":
|
||||||
return log.Errorf, nil
|
return log.Errorf, nil
|
||||||
@@ -101,6 +101,6 @@ func parseLogLevel(c *caddy.Controller, args []string) (func(format string, v ..
|
|||||||
case "debug":
|
case "debug":
|
||||||
return log.Debugf, nil
|
return log.Debugf, nil
|
||||||
default:
|
default:
|
||||||
return nil, c.Err("unknown log level argument in consolidate")
|
return nil, c.Errf("unknown log level argument in consolidate: %s", args[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ func TestProperLogCallbackIsSet(t *testing.T) {
|
|||||||
wantLogLevel string
|
wantLogLevel string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "warn is parsed properly",
|
name: "warning is parsed properly",
|
||||||
inputErrorsRules: `errors {
|
inputErrorsRules: `errors {
|
||||||
consolidate 1m .* warn
|
consolidate 1m .* warning
|
||||||
}`,
|
}`,
|
||||||
wantLogLevel: "[WARNING]",
|
wantLogLevel: "[WARNING]",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user