mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
logging: unify pkg/log and plugin/log (#2245)
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
"github.com/coredns/coredns/plugin/pkg/response"
|
||||
@@ -25,15 +22,6 @@ func setup(c *caddy.Controller) error {
|
||||
return plugin.Error("log", err)
|
||||
}
|
||||
|
||||
// Open the log files for writing when the server starts
|
||||
c.OnStartup(func() error {
|
||||
for i := 0; i < len(rules); i++ {
|
||||
rules[i].Log = log.New(os.Stdout, "", 0)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
|
||||
return Logger{Next: next, Rules: rules, ErrorFunc: dnsserver.DefaultErrorFunc}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user