logs: work around logcheck

logcheck complains:
Additional arguments to ErrorS should always be Key Value pairs. Please check if there is any key or value missing.

That check is intentional, but not applicable here. The check can be worked
around by calling the functions through variables.
This commit is contained in:
Patrick Ohly 2021-11-30 16:29:32 +01:00
parent 072859c967
commit b8501fc10b

View File

@ -70,10 +70,17 @@ func printf(item logMessage) {
}
}
// These variables are a workaround for logcheck complaining about the dynamic
// parameters.
var (
errorS = klog.ErrorS
infoS = klog.InfoS
)
func prints(item logMessage) {
if item.isError {
klog.ErrorS(item.err, item.msg, item.kvs...)
errorS(item.err, item.msg, item.kvs...)
} else {
klog.InfoS(item.msg, item.kvs...)
infoS(item.msg, item.kvs...)
}
}