|
@@ -17,11 +17,14 @@ func DedupedErrorf(format string, logTypeLimit int, a ...interface{}) {
|
|
|
timesLogged, ok := seen[format]
|
|
timesLogged, ok := seen[format]
|
|
|
if !ok {
|
|
if !ok {
|
|
|
seen[format] = 1
|
|
seen[format] = 1
|
|
|
- } else if timesLogged > logTypeLimit {
|
|
|
|
|
|
|
+ } else if timesLogged == logTypeLimit {
|
|
|
|
|
+ seen[format]++
|
|
|
f := fmt.Sprintf("[Error] %s", format)
|
|
f := fmt.Sprintf("[Error] %s", format)
|
|
|
- klog.Errorf("%s seen more than %d times, suppressing future logs", f, logTypeLimit)
|
|
|
|
|
|
|
+ klog.Errorf("%s seen %d times, suppressing future logs", f, logTypeLimit)
|
|
|
|
|
+ } else if timesLogged > logTypeLimit {
|
|
|
|
|
+ seen[format]++
|
|
|
} else {
|
|
} else {
|
|
|
- seen[format] += 1
|
|
|
|
|
|
|
+ seen[format]++
|
|
|
klog.Errorf(fmt.Sprintf("[Error] %s", format), a...)
|
|
klog.Errorf(fmt.Sprintf("[Error] %s", format), a...)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -34,11 +37,14 @@ func DedupedWarningf(format string, logTypeLimit int, a ...interface{}) {
|
|
|
timesLogged, ok := seen[format]
|
|
timesLogged, ok := seen[format]
|
|
|
if !ok {
|
|
if !ok {
|
|
|
seen[format] = 1
|
|
seen[format] = 1
|
|
|
|
|
+ } else if timesLogged == logTypeLimit {
|
|
|
|
|
+ seen[format]++
|
|
|
|
|
+ f := fmt.Sprintf("[Warning] %s", format)
|
|
|
|
|
+ klog.Errorf("%s seen %d times, suppressing future logs", f, logTypeLimit)
|
|
|
} else if timesLogged > logTypeLimit {
|
|
} else if timesLogged > logTypeLimit {
|
|
|
- f := fmt.Sprintf("[Error] %s", format)
|
|
|
|
|
- klog.Errorf("%s seen more than %d times, suppressing future logs", f, logTypeLimit)
|
|
|
|
|
|
|
+ seen[format]++
|
|
|
} else {
|
|
} else {
|
|
|
- seen[format] += 1
|
|
|
|
|
|
|
+ seen[format]++
|
|
|
klog.V(2).Infof(fmt.Sprintf("[Warning] %s", format), a...)
|
|
klog.V(2).Infof(fmt.Sprintf("[Warning] %s", format), a...)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -47,6 +53,22 @@ func Infof(format string, a ...interface{}) {
|
|
|
klog.V(3).Infof(fmt.Sprintf("[Info] %s", format), a...)
|
|
klog.V(3).Infof(fmt.Sprintf("[Info] %s", format), a...)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func DedupedInfof(format string, logTypeLimit int, a ...interface{}) {
|
|
|
|
|
+ timesLogged, ok := seen[format]
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ seen[format] = 1
|
|
|
|
|
+ } else if timesLogged == logTypeLimit {
|
|
|
|
|
+ seen[format]++
|
|
|
|
|
+ f := fmt.Sprintf("[Info] %s", format)
|
|
|
|
|
+ klog.Errorf("%s seen %d times, suppressing future logs", f, logTypeLimit)
|
|
|
|
|
+ } else if timesLogged > logTypeLimit {
|
|
|
|
|
+ seen[format]++
|
|
|
|
|
+ } else {
|
|
|
|
|
+ seen[format]++
|
|
|
|
|
+ klog.V(3).Infof(fmt.Sprintf("[Info] %s", format), a...)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func Profilef(format string, a ...interface{}) {
|
|
func Profilef(format string, a ...interface{}) {
|
|
|
klog.V(3).Infof(fmt.Sprintf("[Profiler] %s", format), a...)
|
|
klog.V(3).Infof(fmt.Sprintf("[Profiler] %s", format), a...)
|
|
|
}
|
|
}
|