Skip to content

Commit

Permalink
Merge pull request wildfly#317 from yersan/JBEAP-27372
Browse files Browse the repository at this point in the history
Configure Kubernetes client go logger with the same logger used by th…
  • Loading branch information
yersan authored Oct 17, 2024
2 parents fd76765 + f85fea7 commit f07568c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"github.com/RHsyseng/operator-utils/pkg/utils/openshift"
"go.uber.org/zap/zapcore"
"k8s.io/klog/v2"
"os"
goruntime "runtime"
"time"
Expand Down Expand Up @@ -73,13 +74,16 @@ func main() {
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")

opts := zap.Options{
TimeEncoder: zapcore.ISO8601TimeEncoder,
}
opts.BindFlags(flag.CommandLine)
flag.Parse()

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
logger := zap.New(zap.UseFlagOptions(&opts))
ctrl.SetLogger(logger)
klog.SetLogger(logger)

printVersion()

Expand Down

0 comments on commit f07568c

Please sign in to comment.