Skip to content

Commit

Permalink
Fix logger init with console format
Browse files Browse the repository at this point in the history
After upgrade zap EncodeTime is required
  • Loading branch information
chapsuk committed Aug 21, 2024
1 parent f3da7bd commit ea435cb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions logger/zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ func Init(appName, appVersion, level, format string) error {
cfg := zap.NewProductionConfig()
cfg.OutputPaths = []string{"stdout"}
cfg.ErrorOutputPaths = []string{"stdout"}
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder

cfg.Encoding = format
switch format {
case "console":
cfg.DisableCaller = true
cfg.DisableStacktrace = true
cfg.EncoderConfig.EncodeLevel = nil
cfg.EncoderConfig.EncodeTime = nil
default:
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
}

var lvl zapcore.Level
Expand Down

0 comments on commit ea435cb

Please sign in to comment.