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.
This commit is contained in:
Yusuke Kuoka 2022-03-08 10:34:52 +09:00 committed by GitHub
parent 15ee6d6360
commit 301439b06a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"strconv" "strconv"
"time"
"github.com/go-logr/logr" "github.com/go-logr/logr"
zaplib "go.uber.org/zap" zaplib "go.uber.org/zap"
@ -48,6 +49,7 @@ func NewLogger(logLevel string) logr.Logger {
atomicLevel := zaplib.NewAtomicLevelAt(level) atomicLevel := zaplib.NewAtomicLevelAt(level)
o.Level = &atomicLevel o.Level = &atomicLevel
} }
o.TimeEncoder = zapcore.TimeEncoderOfLayout(time.RFC3339)
}) })
return log return log