File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
commands/operator-sdk/cmd/up
test/ansible-operator/cmd/ansible-operator Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import (
38
38
"github.com/spf13/cobra"
39
39
"sigs.k8s.io/controller-runtime/pkg/client/config"
40
40
"sigs.k8s.io/controller-runtime/pkg/manager"
41
+ logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
41
42
)
42
43
43
44
func NewLocalCmd () * cobra.Command {
@@ -131,6 +132,9 @@ func upLocal() {
131
132
func upLocalAnsible () {
132
133
// Set the kubeconfig that the manager will be able to grab
133
134
os .Setenv (k8sutil .KubeConfigEnvVar , kubeConfig )
135
+
136
+ logf .SetLogger (logf .ZapLogger (false ))
137
+
134
138
mgr , err := manager .New (config .GetConfigOrDie (), manager.Options {Namespace : namespace })
135
139
if err != nil {
136
140
log .Fatal (err )
Original file line number Diff line number Diff line change @@ -22,13 +22,17 @@ import (
22
22
// Usage: log.V(LogVerbosity).Info(...)
23
23
type LogVerbosity = int
24
24
25
+ // The default log verbosity, given to the most important log statements,
26
+ // is 0: log.V(0).Info(...) == log.Info(...)
27
+ //
28
+ // HACK: zapr doesn't calculate log levels correctly, so we must set log
29
+ // level integers incorrectly (according to logr) for now so they map to zapr's.
25
30
const (
26
- // Default of 0. log.V(0).Info(...) == log.Info(...)
27
- _ LogVerbosity = iota
31
+ // VDebug == -1. log.V(VDebug).Info(...) == log.Debug(...)
32
+ VDebug LogVerbosity = iota - 1
33
+ _
28
34
// VWarn == 1. log.V(VWarn).Info(...) == log.Warn(...)
29
35
VWarn
30
- // VDebug == 2. log.V(VDebug).Info(...) == log.Debug(...)
31
- VDebug
32
36
)
33
37
34
38
// SDKLog is the parent logger for logs generated by operator code.
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
27
27
log "github.com/sirupsen/logrus"
28
28
"sigs.k8s.io/controller-runtime/pkg/client/config"
29
29
"sigs.k8s.io/controller-runtime/pkg/manager"
30
+ logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
30
31
)
31
32
32
33
func printVersion () {
@@ -38,6 +39,8 @@ func printVersion() {
38
39
func main () {
39
40
flag .Parse ()
40
41
42
+ logf .SetLogger (logf .ZapLogger (true ))
43
+
41
44
namespace , err := k8sutil .GetWatchNamespace ()
42
45
if err != nil {
43
46
log .Fatalf ("failed to get watch namespace: (%v)" , err )
You can’t perform that action at this time.
0 commit comments