From 301439b06add79f714a65e6b409115d96f345ac1 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Tue, 8 Mar 2022 10:34:52 +0900 Subject: [PATCH] chore: Change log ts format to RFC3339 (#1191) The TimeEncoder for zap seems to have been set to EpochTimeEncoder which is the default and it was not very readable. Changing it to a TimeEncoderOfLayout(time.RFC3339) for readability. Another benefit of doing this is the ts format is now consistent with various timestamps ARC put into pod and other custom resource annotations. --- logging/logger.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logging/logger.go b/logging/logger.go index 463726b9..97005610 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "strconv" + "time" "github.com/go-logr/logr" zaplib "go.uber.org/zap" @@ -48,6 +49,7 @@ func NewLogger(logLevel string) logr.Logger { atomicLevel := zaplib.NewAtomicLevelAt(level) o.Level = &atomicLevel } + o.TimeEncoder = zapcore.TimeEncoderOfLayout(time.RFC3339) }) return log