Documentation ¶
Index ¶
- Variables
- func Cleanup()
- func Debug(msg string, fields ...zapcore.Field)
- func Error(msg string, fields ...zapcore.Field)
- func Fatal(msg string, fields ...zapcore.Field)
- func Info(msg string, fields ...zapcore.Field)
- func InitializeLogger(cfg zap.Config)
- func Warn(msg string, fields ...zapcore.Field)
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = zap.Config{ Encoding: "console", Level: zap.NewAtomicLevelAt(zapcore.DebugLevel), OutputPaths: []string{"stderr"}, ErrorOutputPaths: []string{"stderr"}, EncoderConfig: zapcore.EncoderConfig{ MessageKey: "message", LevelKey: "level", EncodeLevel: zapcore.CapitalLevelEncoder, TimeKey: "time", EncodeTime: zapcore.ISO8601TimeEncoder, CallerKey: "caller", EncodeCaller: zapcore.ShortCallerEncoder, }, }
Functions ¶
func Cleanup ¶
func Cleanup()
Cleanup flushes all log entries. The reason is certain loggers might not write each log message to its destination immediately upon receiving it. The logger could accumulate several log messages in memory and then write them out in a single batch. So call Cleanup before the application exits to make sure all buffered logs are properly written. E.g. defer log.Cleanup()
func Debug ¶
Debug logs a message at level Debug on the standard logger. log.Debug("This is a DEBUG message")
func Error ¶
Error logs a message at level Error on the standard logger. log.Error("This is an ERROR message")
func Fatal ¶
Fatal logs a message at level Fatal on the standard logger. After logging, it will call os.Exit(1). log.Fatal("This is a FATAL message")
func Info ¶
Info logs a message at level Info on the standard logger. log.Info("This is an INFO message") log.Info("This is an INFO message with fields", zap.String("region", "APAC"), zap.Int("id", 1))
func InitializeLogger ¶
Types ¶
This section is empty.