package logger import ( "os" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) var Logger *zap.Logger func InitLogger() { config := zap.NewProductionEncoderConfig() config.EncodeTime = zapcore.ISO8601TimeEncoder consoleEncoder := zapcore.NewConsoleEncoder(config) defaultLogLevel := zapcore.InfoLevel core := zapcore.NewCore(consoleEncoder, zapcore.AddSync(os.Stdout), defaultLogLevel) Logger = zap.New(core, zap.AddCaller(), zap.AddStacktrace(zapcore.ErrorLevel)) }