Skip to content

Commit

Permalink
Don't discard klog logs at the highest log levels (debug and trace)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarkhas committed Dec 18, 2024
1 parent 2a45cc8 commit c25a229
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ func main() {
}
log.SetLevel(ll)

// Klog V2 is used by k8s.io/apimachinery/pkg/labels and can throw (a lot) of irrelevant logs
// See https://github.com/kubernetes-sigs/external-dns/issues/2348
defer klog.ClearLogger()
klog.SetLogger(logr.Discard())
if ll >= log.DebugLevel {
// Klog V2 is used by k8s.io/apimachinery/pkg/labels and can throw (a lot) of irrelevant logs
// See https://github.com/kubernetes-sigs/external-dns/issues/2348
defer klog.ClearLogger()
klog.SetLogger(logr.Discard())
}

ctx, cancel := context.WithCancel(context.Background())

Expand Down

0 comments on commit c25a229

Please sign in to comment.