From 8442eef72bf7bb595096189a28f1ed929aeba894 Mon Sep 17 00:00:00 2001 From: Dario Tranchitella Date: Thu, 19 Nov 2020 07:58:24 +0100 Subject: [PATCH] Logging timestamp to ISO 8601 (#140) --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index cb2ab9c3..dd763a6c 100644 --- a/main.go +++ b/main.go @@ -23,11 +23,11 @@ import ( "regexp" goRuntime "runtime" + "go.uber.org/zap/zapcore" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -90,8 +90,12 @@ func main() { "during Namespace creation, to name it using the selected Tenant name as prefix, separated by a dash. "+ "This is useful to avoid Namespace name collision in a public CaaS environment.") flag.StringVar(&protectedNamespaceRegexpString, "protected-namespace-regex", "", "Disallow creation of namespaces, whose name matches this regexp") - opts := zap.Options{} + opts := zap.Options{ + EncoderConfigOptions: append([]zap.EncoderConfigOption{}, func(config *zapcore.EncoderConfig) { + config.EncodeTime = zapcore.ISO8601TimeEncoder + }), + } opts.BindFlags(flag.CommandLine) flag.Parse()