mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2025-01-10 01:02:11 +08:00
28 lines
555 B
Go
28 lines
555 B
Go
package log
|
|
|
|
import (
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var rootLogger *zap.Logger
|
|
|
|
// GetLogger returns a named logger
|
|
func GetLogger(name string) *zap.SugaredLogger {
|
|
return rootLogger.Named(name).Sugar()
|
|
}
|
|
|
|
func init() {
|
|
level := zap.InfoLevel
|
|
|
|
cfg := zap.Config{
|
|
Level: zap.NewAtomicLevelAt(level),
|
|
Development: false,
|
|
Encoding: "console",
|
|
EncoderConfig: zap.NewDevelopmentEncoderConfig(),
|
|
OutputPaths: []string{"stderr"},
|
|
ErrorOutputPaths: []string{"stderr"},
|
|
}
|
|
|
|
rootLogger, _ = cfg.Build()
|
|
rootLogger.Sugar()
|
|
}
|