Skip to content

Commit ffe4187

Browse files
authored
Print logs in json format (#389)
edit zap.Options for logs
1 parent 88a2a8a commit ffe4187

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
// to ensure that exec-entrypoint and run can make use of them.
3232
_ "k8s.io/client-go/plugin/pkg/client/auth"
3333

34+
"go.uber.org/zap/zapcore"
3435
"k8s.io/apimachinery/pkg/runtime"
3536
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3637
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@@ -76,7 +77,8 @@ func main() {
7677
flag.BoolVar(&enableHTTP2, "enable-http2", false,
7778
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
7879
opts := zap.Options{
79-
Development: true,
80+
Development: false,
81+
StacktraceLevel: zapcore.PanicLevel,
8082
}
8183
opts.BindFlags(flag.CommandLine)
8284
flag.Parse()

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/stretchr/testify v1.10.0
2222
github.com/swisscom/leaselocker v0.2.0
2323
go.uber.org/mock v0.5.2
24+
go.uber.org/zap v1.27.0
2425
k8s.io/api v0.33.3
2526
k8s.io/apimachinery v0.33.3
2627
k8s.io/client-go v0.33.3
@@ -98,7 +99,6 @@ require (
9899
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
99100
go.uber.org/automaxprocs v1.6.0 // indirect
100101
go.uber.org/multierr v1.11.0 // indirect
101-
go.uber.org/zap v1.27.0 // indirect
102102
go.yaml.in/yaml/v2 v2.4.2 // indirect
103103
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
104104
golang.org/x/net v0.42.0 // indirect

0 commit comments

Comments
 (0)