File tree Expand file tree Collapse file tree 4 files changed +13
-60
lines changed Expand file tree Collapse file tree 4 files changed +13
-60
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ require (
1111 github.com/onsi/gomega v1.18.1
1212 github.com/prometheus/client_golang v1.12.1
1313 github.com/prometheus/client_model v0.2.0
14+ go.uber.org/atomic v1.7.0
1415 go.uber.org/goleak v1.1.12
1516 go.uber.org/zap v1.19.1
1617 golang.org/x/sys v0.0.0-20220209214540-3681064d5158
@@ -57,7 +58,6 @@ require (
5758 github.com/prometheus/common v0.32.1 // indirect
5859 github.com/prometheus/procfs v0.7.3 // indirect
5960 github.com/spf13/pflag v1.0.5 // indirect
60- go.uber.org/atomic v1.7.0 // indirect
6161 go.uber.org/multierr v1.6.0 // indirect
6262 golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
6363 golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
2828 "github.com/go-logr/zapr"
2929 "go.uber.org/zap"
3030 "go.uber.org/zap/zapcore"
31+ crlogr "sigs.k8s.io/controller-runtime/pkg/log/logr"
3132)
3233
3334// EncoderConfigOption is a function that can modify a `zapcore.EncoderConfig`.
@@ -37,11 +38,18 @@ type EncoderConfigOption func(*zapcore.EncoderConfig)
3738type NewEncoderFunc func (... EncoderConfigOption ) zapcore.Encoder
3839
3940// New returns a brand new Logger configured with Opts. It
40- // uses KubeAwareEncoder which adds Type information and
41- // Namespace/Name to the log.
42- // Deprecated: use bootstrap.New as instead.
41+ // uses KubeAwareLogger/KubeAwareEncoder which adds Type
42+ // information and Namespace/Name to the log.
4343func New (opts ... Opts ) logr.Logger {
44- return zapr .NewLogger (NewRaw (opts ... ))
44+ zaprLogger := zapr .NewLogger (NewRaw (opts ... ))
45+ o := & Options {}
46+ for _ , opt := range opts {
47+ opt (o )
48+ }
49+ if o .UseKubeAwareEncoder {
50+ return crlogr .NewKubeAwareLogger (zaprLogger , o .Development )
51+ }
52+ return zaprLogger
4553}
4654
4755// Opts allows to manipulate Options.
You can’t perform that action at this time.
0 commit comments