mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
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
This commit is contained in:
@@ -2,8 +2,6 @@ package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
@@ -24,8 +22,6 @@ func setup(c *caddy.Controller) error {
|
||||
return plugin.Error("errors", err)
|
||||
}
|
||||
|
||||
handler.Log = log.New(os.Stdout, "", 0)
|
||||
|
||||
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
|
||||
handler.Next = next
|
||||
return handler
|
||||
@@ -47,12 +43,10 @@ func errorsParse(c *caddy.Controller) (errorHandler, error) {
|
||||
args := c.RemainingArgs()
|
||||
switch len(args) {
|
||||
case 0:
|
||||
handler.LogFile = "stdout"
|
||||
case 1:
|
||||
if args[0] != "stdout" {
|
||||
return handler, fmt.Errorf("invalid log file: %s", args[0])
|
||||
}
|
||||
handler.LogFile = args[0]
|
||||
default:
|
||||
return handler, c.ArgErr()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user