Skip to content

Commit

Permalink
fix: panic when using --log-format-json
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed Feb 24, 2022
1 parent fe1b4bc commit 0af2483
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/secrets-store-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"k8s.io/client-go/kubernetes"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/component-base/config"
json "k8s.io/component-base/logs/json"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -89,7 +90,8 @@ func main() {
flag.Parse()

if *logFormatJSON {
logger, _ := json.NewJSONLogger(nil, nil)
jsonFactory := json.Factory{}
logger, _ := jsonFactory.Create(config.FormatOptions{})
klog.SetLogger(logger)
}
if *enableProfile {
Expand Down

0 comments on commit 0af2483

Please sign in to comment.