Fix logrus formatting

This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

This fix fixes #23459.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2016-06-11 13:16:55 -07:00
parent 3ff8d449c4
commit 85fa96aa57
5 changed files with 9 additions and 9 deletions

View file

@ -130,7 +130,7 @@ func DetectCompression(source []byte) Compression {
Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00},
} { } {
if len(source) < len(m) { if len(source) < len(m) {
logrus.Debugf("Len too short") logrus.Debug("Len too short")
continue continue
} }
if bytes.Compare(m, source[:len(m)]) == 0 { if bytes.Compare(m, source[:len(m)]) == 0 {
@ -408,7 +408,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
} }
case tar.TypeXGlobalHeader: case tar.TypeXGlobalHeader:
logrus.Debugf("PAX Global Extended Headers found and ignored") logrus.Debug("PAX Global Extended Headers found and ignored")
return nil return nil
default: default:

View file

@ -155,7 +155,7 @@ func (rm *responseModifier) Hijack() (net.Conn, *bufio.ReadWriter, error) {
func (rm *responseModifier) CloseNotify() <-chan bool { func (rm *responseModifier) CloseNotify() <-chan bool {
closeNotifier, ok := rm.rw.(http.CloseNotifier) closeNotifier, ok := rm.rw.(http.CloseNotifier)
if !ok { if !ok {
logrus.Errorf("Internal response writer doesn't support the CloseNotifier interface") logrus.Error("Internal response writer doesn't support the CloseNotifier interface")
return nil return nil
} }
return closeNotifier.CloseNotify() return closeNotifier.CloseNotify()
@ -165,7 +165,7 @@ func (rm *responseModifier) CloseNotify() <-chan bool {
func (rm *responseModifier) Flush() { func (rm *responseModifier) Flush() {
flusher, ok := rm.rw.(http.Flusher) flusher, ok := rm.rw.(http.Flusher)
if !ok { if !ok {
logrus.Errorf("Internal response writer doesn't support the Flusher interface") logrus.Error("Internal response writer doesn't support the Flusher interface")
return return
} }

View file

@ -279,7 +279,7 @@ func LogInit(logger DevmapperLogger) {
// SetDevDir sets the dev folder for the device mapper library (usually /dev). // SetDevDir sets the dev folder for the device mapper library (usually /dev).
func SetDevDir(dir string) error { func SetDevDir(dir string) error {
if res := DmSetDevDir(dir); res != 1 { if res := DmSetDevDir(dir); res != 1 {
logrus.Debugf("devicemapper: Error dm_set_dev_dir") logrus.Debug("devicemapper: Error dm_set_dev_dir")
return ErrSetDevDir return ErrSetDevDir
} }
return nil return nil

View file

@ -47,7 +47,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
fi, err := os.Stat(target) fi, err := os.Stat(target)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
logrus.Errorf("There are no more loopback devices available.") logrus.Error("There are no more loopback devices available.")
} }
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
@ -127,7 +127,7 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
// If the call failed, then free the loopback device // If the call failed, then free the loopback device
if err := ioctlLoopClrFd(loopFile.Fd()); err != nil { if err := ioctlLoopClrFd(loopFile.Fd()); err != nil {
logrus.Errorf("Error while cleaning up the loopback device") logrus.Error("Error while cleaning up the loopback device")
} }
loopFile.Close() loopFile.Close()
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice

View file

@ -49,11 +49,11 @@ func Trap(cleanup func()) {
} }
} else { } else {
// 3 SIGTERM/INT signals received; force exit without cleanup // 3 SIGTERM/INT signals received; force exit without cleanup
logrus.Infof("Forcing docker daemon shutdown without cleanup; 3 interrupts received") logrus.Info("Forcing docker daemon shutdown without cleanup; 3 interrupts received")
} }
case syscall.SIGQUIT: case syscall.SIGQUIT:
DumpStacks() DumpStacks()
logrus.Infof("Forcing docker daemon shutdown without cleanup on SIGQUIT") logrus.Info("Forcing docker daemon shutdown without cleanup on SIGQUIT")
} }
//for the SIGINT/TERM, and SIGQUIT non-clean shutdown case, exit with 128 + signal # //for the SIGINT/TERM, and SIGQUIT non-clean shutdown case, exit with 128 + signal #
os.Exit(128 + int(sig.(syscall.Signal))) os.Exit(128 + int(sig.(syscall.Signal)))