Replace logger.Warn(f) with logger.Warning(f)

This aligns better with klog used in other projects.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-06-06 21:46:38 +02:00
parent 9464953924
commit 1d0a733487
20 changed files with 39 additions and 43 deletions

View File

@@ -286,7 +286,7 @@ func resolveWithDefault(logger logger.Interface, label string, path string, defa
resolvedPath := defaultPath
targets, err := lookup.Locate(path)
if err != nil {
logger.Warnf("Failed to locate %v: %v", path, err)
logger.Warningf("Failed to locate %v: %v", path, err)
} else {
logger.Debugf("Found %v candidates: %v", path, targets)
resolvedPath = targets[0]

View File

@@ -29,7 +29,7 @@ import (
// single CSV files.
func NewFromCSVFiles(logger logger.Interface, files []string, driverRoot string) (Discover, error) {
if len(files) == 0 {
logger.Warnf("No CSV files specified")
logger.Warningf("No CSV files specified")
return None{}, nil
}
@@ -46,7 +46,7 @@ func NewFromCSVFiles(logger logger.Interface, files []string, driverRoot string)
for _, filename := range files {
targets, err := loadCSVFile(logger, filename)
if err != nil {
logger.Warnf("Skipping CSV file %v: %v", filename, err)
logger.Warningf("Skipping CSV file %v: %v", filename, err)
continue
}
mountSpecs = append(mountSpecs, targets...)

View File

@@ -259,7 +259,7 @@ var _ Discover = (*xorgHooks)(nil)
func optionalXorgDiscoverer(logger logger.Interface, driverRoot string, nvidiaCTKPath string) Discover {
xorg, err := newXorgDiscoverer(logger, driverRoot, nvidiaCTKPath)
if err != nil {
logger.Warnf("Failed to create Xorg discoverer: %v; skipping xorg libraries", err)
logger.Warningf("Failed to create Xorg discoverer: %v; skipping xorg libraries", err)
return None{}
}
return xorg

View File

@@ -75,11 +75,11 @@ func (d *mounts) Mounts() ([]Mount, error) {
d.logger.Debugf("Locating %v", candidate)
located, err := d.lookup.Locate(candidate)
if err != nil {
d.logger.Warnf("Could not locate %v: %v", candidate, err)
d.logger.Warningf("Could not locate %v: %v", candidate, err)
continue
}
if len(located) == 0 {
d.logger.Warnf("Missing %v", candidate)
d.logger.Warningf("Missing %v", candidate)
continue
}
d.logger.Debugf("Located %v as %v", candidate, located)

View File

@@ -129,7 +129,7 @@ func (d symlinkHook) getCSVFileSymlinks() []string {
}
targets, err := chainLocator.Locate(ms.Path)
if err != nil {
d.logger.Warnf("Failed to locate symlink %v", ms.Path)
d.logger.Warningf("Failed to locate symlink %v", ms.Path)
}
candidates = append(candidates, targets...)
}

View File

@@ -22,7 +22,6 @@ type Interface interface {
Errorf(string, ...interface{})
Info(...interface{})
Infof(string, ...interface{})
Warn(...interface{})
Warnf(string, ...interface{})
Warning(...interface{})
Warningf(string, ...interface{})
}

View File

@@ -40,11 +40,8 @@ func (l *NullLogger) Info(...interface{}) {}
// Infof is a no-op for the null logger
func (l *NullLogger) Infof(string, ...interface{}) {}
// Warn is a no-op for the null logger
func (l *NullLogger) Warn(...interface{}) {}
// Warnf is a no-op for the null logger
func (l *NullLogger) Warnf(string, ...interface{}) {}
// Warning is a no-op for the null logger
func (l *NullLogger) Warning(...interface{}) {}
// Warningf is a no-op for the null logger
func (l *NullLogger) Warningf(string, ...interface{}) {}

View File

@@ -58,7 +58,7 @@ func (l library) Locate(libname string) ([]string, error) {
paths32, paths64 := l.cache.Lookup(libname)
if len(paths32) > 0 {
l.logger.Warnf("Ignoring 32-bit libraries for %v: %v", libname, paths32)
l.logger.Warningf("Ignoring 32-bit libraries for %v: %v", libname, paths32)
}
if len(paths64) == 0 {

View File

@@ -115,14 +115,14 @@ func checkRequirements(logger logger.Interface, image image.CUDA) error {
cudaVersion, err := cuda.Version()
if err != nil {
logger.Warnf("Failed to get CUDA version: %v", err)
logger.Warningf("Failed to get CUDA version: %v", err)
} else {
r.AddVersionProperty(requirements.CUDA, cudaVersion)
}
compteCapability, err := cuda.ComputeCapability(0)
if err != nil {
logger.Warnf("Failed to get CUDA Compute Capability: %v", err)
logger.Warningf("Failed to get CUDA Compute Capability: %v", err)
} else {
r.AddVersionProperty(requirements.ARCH, compteCapability)
}

View File

@@ -52,7 +52,7 @@ func (l *Logger) Update(filename string, logLevel string, argv []string) {
level, logLevelError := configFromArgs.getLevel(logLevel)
defer func() {
if logLevelError != nil {
l.Warn(logLevelError)
l.Warning(logLevelError)
}
}()
@@ -77,7 +77,7 @@ func (l *Logger) Update(filename string, logLevel string, argv []string) {
}
defer func() {
if argLogFileError != nil {
l.Warnf("Failed to open log file: %v", argLogFileError)
l.Warningf("Failed to open log file: %v", argLogFileError)
}
}()