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

@@ -38,7 +38,7 @@ import (
"k8s.io/client-go/transport"
certutil "k8s.io/client-go/util/cert"
"k8s.io/client-go/util/flowcontrol"
"k8s.io/klog"
"k8s.io/klog/v2"
)
const (

View File

@@ -21,7 +21,7 @@ import (
"net/http"
"sync"
"k8s.io/klog"
"k8s.io/klog/v2"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
)

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 {

View File

@@ -36,7 +36,7 @@ import (
"testing"
"time"
"k8s.io/klog"
"k8s.io/klog/v2"
v1 "k8s.io/api/core/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"

View File

@@ -22,7 +22,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/util/flowcontrol"
"k8s.io/klog"
"k8s.io/klog/v2"
)
// Set of resp. Codes that we backoff for.