Skip to content

Commit

Permalink
[controller] Fix textlogger initialization (#68)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Stefurishin <[email protected]>
  • Loading branch information
astef authored Jan 17, 2025
1 parent d23aedd commit 3cfe447
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion images/controller/src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module d8-controller
go 1.23.4

require (
github.com/deckhouse/csi-nfs/api v0.0.0-20250114120436-92edf4aa86c9
github.com/deckhouse/csi-nfs/api v0.0.0-20250116103144-d23aedd591a3
github.com/go-logr/logr v1.4.2
github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
Expand Down
10 changes: 9 additions & 1 deletion images/controller/src/pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package logger
import (
"flag"
"fmt"
"strconv"

"github.com/go-logr/logr"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -55,7 +56,14 @@ func NewLogger(level Verbosity) (*Logger, error) {
}
flag.Parse()

log := textlogger.NewLogger(&textlogger.Config{})
levelInt, err := strconv.Atoi(string(level))
if err != nil {
return nil, err
}

log := textlogger.NewLogger(
textlogger.NewConfig(textlogger.Verbosity(levelInt)),
)

return &Logger{log: log}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion images/webhooks/src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module webhooks
go 1.23.4

require (
github.com/deckhouse/csi-nfs/api v0.0.0-20250114120436-92edf4aa86c9
github.com/deckhouse/csi-nfs/api v0.0.0-20250116103144-d23aedd591a3
github.com/go-logr/logr v1.4.2
github.com/sirupsen/logrus v1.9.3
github.com/slok/kubewebhook/v2 v2.7.0
Expand Down

0 comments on commit 3cfe447

Please sign in to comment.