Skip to content

Commit 9319337

Browse files
authored
Ensure consistent log format (#326)
* Ensure client-go-originating logs are consistent with zap logger * Link to GitHub comment explaining change
1 parent 6f4a377 commit 9319337

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package main
1212
import (
1313
"flag"
1414
"fmt"
15+
"k8s.io/klog/v2"
1516
"os"
1617
"regexp"
1718
"strings"
@@ -73,7 +74,10 @@ func main() {
7374

7475
flag.Parse()
7576

76-
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
77+
logger := zap.New(zap.UseFlagOptions(&opts))
78+
ctrl.SetLogger(logger)
79+
// https://github.com/kubernetes-sigs/controller-runtime/issues/1420#issuecomment-794525248
80+
klog.SetLogger(logger.WithName("messaging-topology-operator"))
7781

7882
operatorNamespace := os.Getenv(controllers.OperatorNamespaceEnvVar)
7983
if operatorNamespace == "" {

0 commit comments

Comments
 (0)