refactor db out
This commit is contained in:
20
log/log.go
20
log/log.go
@ -39,3 +39,23 @@ func init() {
|
||||
|
||||
GLogr = zapr.NewLogger(logger)
|
||||
}
|
||||
|
||||
func GetZapLogger() logr.Logger {
|
||||
//json logging
|
||||
cfg := zap.NewProductionConfig()
|
||||
devCfg := zap.NewDevelopmentConfig()
|
||||
|
||||
// Readable time stamp
|
||||
cfg.EncoderConfig.EncodeTime = devCfg.EncoderConfig.EncodeTime
|
||||
|
||||
// Uncomment to enable debug logging
|
||||
// cfg.Level = devCfg.Level
|
||||
|
||||
logger, err := cfg.Build()
|
||||
if err != nil {
|
||||
println("unable to intialize zap log")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return zapr.NewLogger(logger)
|
||||
}
|
||||
|
Reference in New Issue
Block a user