Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"

"github.com/alecthomas/kingpin/v2"
"github.com/go-logr/logr"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -62,11 +63,16 @@ func main() {

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-sql"))

// controller-runtime leaves its root logger unset by default and emits a
// "log.SetLogger(...) was never called" warning (with a stack trace) on
// every reconcile when it is never set. It is also very verbose even at
// info level, so in non-debug mode we point it at a discard logger to keep
// the previous quiet behaviour while still satisfying controller-runtime.
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
// logger when we're running in debug mode.
ctrl.SetLogger(zl)
} else {
ctrl.SetLogger(logr.Discard())
}

log.Debug("Starting", "sync-period", syncPeriod.String())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/crossplane/crossplane-tools v0.0.0-20260719180100-659f1dc036c5
github.com/crossplane/crossplane/apis/v2 v2.4.0
github.com/crossplane/upjet/v2 v2.2.0
github.com/go-logr/logr v1.4.4
github.com/go-sql-driver/mysql v1.10.0
github.com/google/go-cmp v0.7.0
github.com/lib/pq v1.12.3
Expand Down Expand Up @@ -42,7 +43,6 @@ require (
github.com/fatih/color v1.19.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v1.0.0 // indirect
github.com/go-openapi/jsonreference v1.0.0 // indirect
Expand Down