mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
enhance and fix log calls
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:
- Logging a message only above a certain verbosity threshold without
recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
this matters when using a logging backend which records the verbosity
level.
- Passing a format string with parameters to a logging function that
doesn't do string formatting.
All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.
In some cases it reports false positives, but those can be suppressed with
source code comments.
This commit is contained in:
@@ -399,7 +399,7 @@ func (i *scaleUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runti
|
||||
if _, ok := replicasPathInDeployment[requestGroupVersion.String()]; ok {
|
||||
groupVersion = requestGroupVersion
|
||||
} else {
|
||||
klog.Fatal("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
klog.Fatalf("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ func (i *scaleUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runti
|
||||
if _, ok := replicasPathInReplicaSet[requestGroupVersion.String()]; ok {
|
||||
groupVersion = requestGroupVersion
|
||||
} else {
|
||||
klog.Fatal("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
klog.Fatalf("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ func (i *scaleUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runti
|
||||
if _, ok := replicasPathInStatefulSet[requestGroupVersion.String()]; ok {
|
||||
groupVersion = requestGroupVersion
|
||||
} else {
|
||||
klog.Fatal("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
klog.Fatalf("Unrecognized group/version in request info %q", requestGroupVersion.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user