tss/log/log.go
2022-06-17 18:23:06 -04:00

25 lines
446 B
Go

package log
import (
"github.com/go-logr/logr"
"github.com/go-logr/zapr"
"go.uber.org/zap"
)
func GetZapLogger() logr.Logger {
//json logging
cfg := zap.NewProductionConfig()
devCfg := zap.NewDevelopmentConfig()
// Readable time stamp
cfg.EncoderConfig.EncodeTime = devCfg.EncoderConfig.EncodeTime
logger, err := cfg.Build()
if err != nil {
println("unable to intialize zap log")
panic(err)
}
return zapr.NewLogger(logger)
}