1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-05 03:45:02 +01:00

code changes for k8s.io/klog/v2

This commit is contained in:
Corey Daley
2020-10-01 20:59:50 -04:00
parent aa7e3310e9
commit 8ca83f8ce1
5 changed files with 8 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ import (
"runtime"
"time"
"k8s.io/klog"
"k8s.io/klog/v2"
"github.com/openshift/source-to-image/pkg/cmd/cli"
)

View File

@@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
log "k8s.io/klog"
log "k8s.io/klog/v2"
"github.com/openshift/source-to-image/pkg/api"
)

View File

@@ -5,7 +5,7 @@ import (
"path/filepath"
"runtime"
"k8s.io/klog"
"k8s.io/klog/v2"
"github.com/openshift/source-to-image/pkg/api"
"github.com/openshift/source-to-image/pkg/api/constants"

View File

@@ -8,7 +8,7 @@ import (
"strings"
"sync"
"k8s.io/klog"
"k8s.io/klog/v2"
)
// Logger is a simple interface that is roughly equivalent to klog.
@@ -109,7 +109,7 @@ func (f *FileLogger) Is(level int32) bool {
// V will returns a logger which will discard output if the specified level is greater than the current logging level.
func (f *FileLogger) V(level int32) VerboseLogger {
// Is the loglevel set verbose enough to accept the forthcoming log statement
if klog.V(klog.Level(level)) {
if klog.V(klog.Level(level)).Enabled() {
return f
}
// Otherwise discard
@@ -147,7 +147,7 @@ func (f *FileLogger) writeln(sev severity, line string) {
// If the loglevel has been elevated above this file logger's verbosity (generally set to 2)
// then delegate ALL messages to elevated logger in order to leverage its file/line/timestamp
// prefix information.
if klog.V(klog.Level(f.level + 1)) {
if klog.V(klog.Level(f.level + 1)).Enabled() {
severity.delegateFn(3, line)
} else {
// buf.io is not threadsafe, so serialize access to the stream

View File

@@ -21,7 +21,7 @@ import (
dockerapi "github.com/docker/docker/client"
"golang.org/x/net/context"
"k8s.io/klog"
"k8s.io/klog/v2"
"github.com/openshift/source-to-image/pkg/api"
"github.com/openshift/source-to-image/pkg/build"
@@ -195,7 +195,7 @@ func (i *integrationTest) setup() {
from := flag.CommandLine
if vflag := from.Lookup("v"); vflag != nil {
// the thing here is that we are looking for the bash -v passed into test-integration.sh (with no value),
// but for klog (https://k8s.io/klog/blob/master/klog.go), one specifies
// but for klog (https://k8s.io/klog/v2/blob/master/klog.go), one specifies
// the logging level with -v=# (i.e. -v=0 or -v=3 or -v=5).
// so, for the changes stemming from issue 133, we 'reuse' the bash -v, and set the highest klog level.
// (if you look at STI's main.go, and setupGlog, it essentially maps klog's -v to --loglevel for use by the sti command)