Skip to content

Commit

Permalink
Change to ISO8601
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller committed Feb 11, 2025
1 parent 7df704f commit c06561f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions cli/cmd/admin/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func StartCmd(ch *cmdutil.Helper) *cobra.Command {
// Init logger
cfg := zap.NewProductionConfig()
cfg.Level.SetLevel(conf.LogLevel)
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := cfg.Build()
if err != nil {
fmt.Printf("error: failed to create logger: %s\n", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/runtime/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func StartCmd(ch *cmdutil.Helper) *cobra.Command {
cfg := zap.NewProductionConfig()
cfg.Level.SetLevel(conf.LogLevel)
cfg.EncoderConfig.NameKey = zapcore.OmitKey
cfg.EncoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := cfg.Build()
if err != nil {
fmt.Printf("error: failed to create logger: %s\n", err.Error())
Expand Down
4 changes: 2 additions & 2 deletions cli/pkg/local/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func initLogger(isVerbose bool, logFormat LogFormat) (logger *zap.Logger, cleanu
cfg := zap.NewProductionEncoderConfig()
// hide logger name like `console`
cfg.NameKey = zapcore.OmitKey
cfg.EncodeTime = zapcore.RFC3339NanoTimeEncoder
cfg.EncodeTime = zapcore.ISO8601TimeEncoder
fileCore := zapcore.NewCore(zapcore.NewJSONEncoder(cfg), zapcore.AddSync(luLogger), logLevel)

var consoleEncoder zapcore.Encoder
Expand All @@ -534,7 +534,7 @@ func initLogger(isVerbose bool, logFormat LogFormat) (logger *zap.Logger, cleanu
case LogFormatJSON:
cfg := zap.NewProductionEncoderConfig()
cfg.NameKey = zapcore.OmitKey
cfg.EncodeTime = zapcore.RFC3339NanoTimeEncoder
cfg.EncodeTime = zapcore.ISO8601TimeEncoder
// never
opts = append(opts, zap.AddStacktrace(zapcore.InvalidLevel))
consoleEncoder = zapcore.NewJSONEncoder(cfg)
Expand Down

0 comments on commit c06561f

Please sign in to comment.