package log import ( "github.com/go-logr/logr" "github.com/go-logr/zapr" "go.uber.org/zap" ) var Logger *zap.SugaredLogger var GLogr logr.Logger var Debug, Info, Warn, Error, Panic func(msg string, keysAndValues ...interface{}) func init() { //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) } Logger = logger.Sugar() Debug = Logger.Debugw Info = Logger.Infow Warn = Logger.Warnw Error = Logger.Errorw Panic = Logger.Panicw GLogr = zapr.NewLogger(logger) }