Don't discard klog logs at the highest log levels (debug and trace)

This commit is contained in:
Dan Markhasin 2024-12-18 09:45:36 +02:00
parent 2a45cc85a4
commit c25a229e5f

View File

@ -100,10 +100,12 @@ func main() {
} }
log.SetLevel(ll) log.SetLevel(ll)
if ll >= log.DebugLevel {
// Klog V2 is used by k8s.io/apimachinery/pkg/labels and can throw (a lot) of irrelevant logs // 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 // See https://github.com/kubernetes-sigs/external-dns/issues/2348
defer klog.ClearLogger() defer klog.ClearLogger()
klog.SetLogger(logr.Discard()) klog.SetLogger(logr.Discard())
}
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())