File tree 4 files changed +13
-60
lines changed
4 files changed +13
-60
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ require (
11
11
github.com/onsi/gomega v1.18.1
12
12
github.com/prometheus/client_golang v1.12.1
13
13
github.com/prometheus/client_model v0.2.0
14
+ go.uber.org/atomic v1.7.0
14
15
go.uber.org/goleak v1.1.12
15
16
go.uber.org/zap v1.19.1
16
17
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
@@ -57,7 +58,6 @@ require (
57
58
github.com/prometheus/common v0.32.1 // indirect
58
59
github.com/prometheus/procfs v0.7.3 // indirect
59
60
github.com/spf13/pflag v1.0.5 // indirect
60
- go.uber.org/atomic v1.7.0 // indirect
61
61
go.uber.org/multierr v1.6.0 // indirect
62
62
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
63
63
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 (
28
28
"github.com/go-logr/zapr"
29
29
"go.uber.org/zap"
30
30
"go.uber.org/zap/zapcore"
31
+ crlogr "sigs.k8s.io/controller-runtime/pkg/log/logr"
31
32
)
32
33
33
34
// EncoderConfigOption is a function that can modify a `zapcore.EncoderConfig`.
@@ -37,11 +38,18 @@ type EncoderConfigOption func(*zapcore.EncoderConfig)
37
38
type NewEncoderFunc func (... EncoderConfigOption ) zapcore.Encoder
38
39
39
40
// 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.
43
43
func 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
45
53
}
46
54
47
55
// Opts allows to manipulate Options.
You can’t perform that action at this time.
0 commit comments