Skip to content

Commit

Permalink
Revert logging format changes
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Ronquillo <[email protected]>
  • Loading branch information
tammy-young authored and katronquillo committed Jul 2, 2024
1 parent a5ec521 commit 04387b3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func main() {
)
kingpin.MustParse(app.Parse(os.Args[1:]))

zl := zap.New(zap.UseDevMode(*debug), UseJSONencoder())
zl := zap.New(zap.UseDevMode(*debug), UseISO8601())
log := logging.NewLogrLogger(zl.WithName("provider-terraform"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
Expand Down Expand Up @@ -150,11 +150,9 @@ func main() {
kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager")
}

// UseJSONencoder sets the logger to use json format for log records
func UseJSONencoder() zap.Opts {
// UseISO8601 sets the logger to use ISO8601 timestamp format
func UseISO8601() zap.Opts {
return func(o *zap.Options) {
encoderConfig := zapuber.NewProductionEncoderConfig()
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
o.Encoder = zapcore.NewJSONEncoder(encoderConfig)
o.TimeEncoder = zapcore.ISO8601TimeEncoder
}
}

0 comments on commit 04387b3

Please sign in to comment.