Skip to content

Commit

Permalink
Merge pull request #247 from cmssczy/set-default-ts-format
Browse files Browse the repository at this point in the history
set default log timestamp format
  • Loading branch information
k8s-ci-robot committed May 4, 2022
2 parents 169858e + a23c617 commit e5fdd9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"

"go.uber.org/zap/zapcore"
schedulingv1 "k8s.io/api/scheduling/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down Expand Up @@ -67,7 +68,9 @@ func main() {
"The controller will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. ")

opts := zap.Options{}
opts := zap.Options{
TimeEncoder: zapcore.RFC3339NanoTimeEncoder,
}
opts.BindFlags(flag.CommandLine)
flag.Parse()

Expand Down
5 changes: 4 additions & 1 deletion test/integration/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ type Framework struct {
}

func (f *Framework) Setup() (context.Context, *rest.Config, client.Client) {
ctrl.SetLogger(zap.New(zap.WriteTo(ginkgo.GinkgoWriter), zap.UseDevMode(true), zap.Level(zapcore.Level(-3))))
logTimeEncodeOpt := func(o *zap.Options) {
o.TimeEncoder = zapcore.RFC3339NanoTimeEncoder
}
ctrl.SetLogger(zap.New(zap.WriteTo(ginkgo.GinkgoWriter), zap.UseDevMode(true), zap.Level(zapcore.Level(-3)), logTimeEncodeOpt))

ginkgo.By("bootstrapping test environment")
f.testEnv = &envtest.Environment{
Expand Down

0 comments on commit e5fdd9b

Please sign in to comment.