From 85fa96aa5785e05bb3274a95224b8aa3bf918481 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Sat, 11 Jun 2016 13:16:55 -0700 Subject: [PATCH] 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 --- archive/archive.go | 4 ++-- authorization/response.go | 4 ++-- devicemapper/devmapper.go | 2 +- loopback/attach_loopback.go | 4 ++-- signal/trap.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/archive/archive.go b/archive/archive.go index 5ae8ef5..f637277 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -130,7 +130,7 @@ func DetectCompression(source []byte) Compression { Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, } { if len(source) < len(m) { - logrus.Debugf("Len too short") + logrus.Debug("Len too short") continue } 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: - logrus.Debugf("PAX Global Extended Headers found and ignored") + logrus.Debug("PAX Global Extended Headers found and ignored") return nil default: diff --git a/authorization/response.go b/authorization/response.go index f48f071..9eec82d 100644 --- a/authorization/response.go +++ b/authorization/response.go @@ -155,7 +155,7 @@ func (rm *responseModifier) Hijack() (net.Conn, *bufio.ReadWriter, error) { func (rm *responseModifier) CloseNotify() <-chan bool { closeNotifier, ok := rm.rw.(http.CloseNotifier) 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 closeNotifier.CloseNotify() @@ -165,7 +165,7 @@ func (rm *responseModifier) CloseNotify() <-chan bool { func (rm *responseModifier) Flush() { flusher, ok := rm.rw.(http.Flusher) 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 } diff --git a/devicemapper/devmapper.go b/devicemapper/devmapper.go index db3244a..838b06a 100644 --- a/devicemapper/devmapper.go +++ b/devicemapper/devmapper.go @@ -279,7 +279,7 @@ func LogInit(logger DevmapperLogger) { // SetDevDir sets the dev folder for the device mapper library (usually /dev). func SetDevDir(dir string) error { 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 nil diff --git a/loopback/attach_loopback.go b/loopback/attach_loopback.go index c6d72d7..971f45e 100644 --- a/loopback/attach_loopback.go +++ b/loopback/attach_loopback.go @@ -47,7 +47,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil fi, err := os.Stat(target) if err != nil { 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 } @@ -127,7 +127,7 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) { // If the call failed, then free the loopback device 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() return nil, ErrAttachLoopbackDevice diff --git a/signal/trap.go b/signal/trap.go index 874509e..d35ef0e 100644 --- a/signal/trap.go +++ b/signal/trap.go @@ -49,11 +49,11 @@ func Trap(cleanup func()) { } } else { // 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: 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 # os.Exit(128 + int(sig.(syscall.Signal)))