aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2021-07-09 18:38:58 +0200
committerGravatar GitHub <noreply@github.com> 2021-07-09 09:38:58 -0700
commita26462c28cd8a726a9996e60e938f1fbbea5c950 (patch)
tree26f7df9f32378436c50330994873792c55493370
parentbdaa2a55271f88e2bf94ee146e90562f8aa57b34 (diff)
downloadcoredns-a26462c28cd8a726a9996e60e938f1fbbea5c950.tar.gz
coredns-a26462c28cd8a726a9996e60e938f1fbbea5c950.tar.zst
coredns-a26462c28cd8a726a9996e60e938f1fbbea5c950.zip
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>
-rw-r--r--plugin/errors/README.md2
-rw-r--r--plugin/errors/setup.go4
-rw-r--r--plugin/errors/setup_test.go4
3 files changed, 5 insertions, 5 deletions
diff --git a/plugin/errors/README.md b/plugin/errors/README.md
index 4a8ff3ce8..565ef8b20 100644
--- a/plugin/errors/README.md
+++ b/plugin/errors/README.md
@@ -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
-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
~~~
diff --git a/plugin/errors/setup.go b/plugin/errors/setup.go
index 9fc5a3595..67a9fe653 100644
--- a/plugin/errors/setup.go
+++ b/plugin/errors/setup.go
@@ -92,7 +92,7 @@ func parseLogLevel(c *caddy.Controller, args []string) (func(format string, v ..
}
switch args[2] {
- case "warn":
+ case "warning":
return log.Warningf, nil
case "error":
return log.Errorf, nil
@@ -101,6 +101,6 @@ func parseLogLevel(c *caddy.Controller, args []string) (func(format string, v ..
case "debug":
return log.Debugf, nil
default:
- return nil, c.Err("unknown log level argument in consolidate")
+ return nil, c.Errf("unknown log level argument in consolidate: %s", args[2])
}
}
diff --git a/plugin/errors/setup_test.go b/plugin/errors/setup_test.go
index 3bfb87c8d..72fdbcd0a 100644
--- a/plugin/errors/setup_test.go
+++ b/plugin/errors/setup_test.go
@@ -79,9 +79,9 @@ func TestProperLogCallbackIsSet(t *testing.T) {
wantLogLevel string
}{
{
- name: "warn is parsed properly",
+ name: "warning is parsed properly",
inputErrorsRules: `errors {
- consolidate 1m .* warn
+ consolidate 1m .* warning
}`,
wantLogLevel: "[WARNING]",
},