refactor db out

This commit is contained in:
2022-06-17 17:51:16 -04:00
parent 87990aa922
commit 7e92a042ff
4 changed files with 56 additions and 23 deletions

View File

@ -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)
}