mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
loggerutils: build fixes, improve errors
There are two build errors when using go-1.11beta1:
> daemon/logger/loggerutils/logfile.go:367: Warningf format %q arg f.Name is a func value, not called
> daemon/logger/loggerutils/logfile.go:564: Debug call has possible formatting directive %v
In the first place, the file name is actually not required as error
message already includes it.
While at it, fix a couple of other places for more correct messages, and
make sure to not add a file name if an error already has it.
Fixes: f69f09f44c
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2e30e9e6db
commit
09ad434f10
1 changed files with 4 additions and 4 deletions
|
@ -332,7 +332,7 @@ func (w *LogFile) ReadLogs(config logger.ReadConfig, watcher *logger.LogWatcher)
|
|||
if strings.HasSuffix(fileName, tmpLogfileSuffix) {
|
||||
err := w.filesRefCounter.Dereference(fileName)
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to dereference the log file %q: %v", fileName, err)
|
||||
logrus.Errorf("Failed to dereference log file %q: %v", fileName, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ func (w *LogFile) openRotatedFiles(config logger.ReadConfig) (files []*os.File,
|
|||
if strings.HasSuffix(f.Name(), tmpLogfileSuffix) {
|
||||
err := os.Remove(f.Name())
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
logrus.Warningf("Failed to remove the logfile %q: %v", f.Name, err)
|
||||
logrus.Warnf("Failed to remove logfile: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ func decompressfile(fileName, destFileName string, since time.Time) (*os.File, e
|
|||
rs.Close()
|
||||
rErr := os.Remove(rs.Name())
|
||||
if rErr != nil && !os.IsNotExist(rErr) {
|
||||
logrus.Errorf("Failed to remove the logfile %q: %v", rs.Name(), rErr)
|
||||
logrus.Errorf("Failed to remove logfile: %v", rErr)
|
||||
}
|
||||
return nil, errors.Wrap(err, "error while copying decompressed log stream to file")
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ func followLogs(f *os.File, logWatcher *logger.LogWatcher, notifyRotate chan int
|
|||
}
|
||||
return errRetry
|
||||
case err := <-fileWatcher.Errors():
|
||||
logrus.Debug("logger got error watching file: %v", err)
|
||||
logrus.Debugf("logger got error watching file: %v", err)
|
||||
// Something happened, let's try and stay alive and create a new watcher
|
||||
if retries <= 5 {
|
||||
fileWatcher.Close()
|
||||
|
|
Loading…
Add table
Reference in a new issue