mirror of https://github.com/knative/pkg.git
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:
parent
55831d9ef7
commit
60e39237f6
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue