package logger import ( "fmt" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) var L *zap.SugaredLogger func Init(level zap.AtomicLevel) { conf := zap.Config{ Level: level, Encoding: "console", OutputPaths: []string{"stdout"}, ErrorOutputPaths: []string{"stderr"}, EncoderConfig: zap.NewDevelopmentEncoderConfig(), } conf.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder if l, err := conf.Build(); err != nil { panic(fmt.Errorf("failed to init logger: %w", err)) } else { L = l.Sugar() } }