Pass verbosity level on to klog (#1118)

* Pass verbosity level on to klog

This was left out of #1022

* Missed capitalization
This commit is contained in:
coryrc 2020-02-24 13:37:08 -08:00 committed by GitHub
parent 55831d9ef7
commit 60e39237f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@ package logging
import (
"context"
"flag"
"fmt"
"os"
"strings"
"sync"
@ -32,6 +33,7 @@ import (
"go.opencensus.io/trace"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"k8s.io/klog"
)
const (
@ -159,6 +161,10 @@ func InitializeLogger() {
logger = zap.New(zapCore)
zap.ReplaceGlobals(logger) // Gets used by klog/glog proxy libraries
// Set klog/glog verbosities (works with and without proxy libraries)
klogLevel := klog.Level(0)
klogLevel.Set(fmt.Sprint(verbosity))
if verbosity > 2 {
printFlags()
}