Skip to content

Commit 30ccbcb

Browse files
authored
Merge pull request #4961 from dmarkhas/allow_klog
feat: don't discard klog logs at the highest log levels (debug and trace)
2 parents 8907080 + 7debf8a commit 30ccbcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ func main() {
100100
}
101101
log.SetLevel(ll)
102102

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

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

0 commit comments

Comments
 (0)