switch over k/k to use klog v2

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
This commit is contained in:
Davanum Srinivas
2020-04-17 15:25:06 -04:00
committed by Kubernetes Publisher
parent 6d56f3d16b
commit 75fea27a27
46 changed files with 55 additions and 55 deletions

View File

@@ -45,7 +45,7 @@ import (
restclientwatch "k8s.io/client-go/rest/watch"
"k8s.io/client-go/tools/metrics"
"k8s.io/client-go/util/flowcontrol"
"k8s.io/klog"
"k8s.io/klog/v2"
)
var (
@@ -608,7 +608,7 @@ var globalThrottledLogger = &throttledLogger{
func (b *throttledLogger) attemptToLog() (klog.Level, bool) {
for _, setting := range b.settings {
if bool(klog.V(setting.logLevel)) {
if bool(klog.V(setting.logLevel).Enabled()) {
// Return early without write locking if possible.
if func() bool {
setting.lock.RLock()
@@ -1053,11 +1053,11 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
func truncateBody(body string) string {
max := 0
switch {
case bool(klog.V(10)):
case bool(klog.V(10).Enabled()):
return body
case bool(klog.V(9)):
case bool(klog.V(9).Enabled()):
max = 10240
case bool(klog.V(8)):
case bool(klog.V(8).Enabled()):
max = 1024
}
@@ -1072,7 +1072,7 @@ func truncateBody(body string) string {
// allocating a new string for the body output unless necessary. Uses a simple heuristic to determine
// whether the body is printable.
func glogBody(prefix string, body []byte) {
if klog.V(8) {
if klog.V(8).Enabled() {
if bytes.IndexFunc(body, func(r rune) bool {
return r < 0x0a
}) != -1 {