Skip to content

Commit

Permalink
Chore: Update default log level Debug->Info (#1794)
Browse files Browse the repository at this point in the history
Due to using production mode, the default encoder changed to json
  • Loading branch information
Baarsgaard authored Dec 18, 2024
1 parent ac4e3b0 commit 7d46ac8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ build: generate code/gofumpt vet ## Build manager binary.

.PHONY: run
run: manifests generate code/gofumpt vet ## Run a controller from your host.
go run ./main.go
go run ./main.go --zap-devel=true

##@ Deployment

Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"strings"
"syscall"

uberzap "go.uber.org/zap"
"go.uber.org/zap/zapcore"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down Expand Up @@ -90,8 +92,11 @@ func main() {
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&pprofAddr, "pprof-addr", ":8888", "The address to expose the pprof server. Empty string disables the pprof server.")

logCfg := uberzap.NewProductionEncoderConfig()
logCfg.EncodeTime = zapcore.ISO8601TimeEncoder
opts := zap.Options{
Development: true,
Encoder: zapcore.NewConsoleEncoder(logCfg),
}
opts.BindFlags(flag.CommandLine)
flag.Parse()
Expand Down

0 comments on commit 7d46ac8

Please sign in to comment.