Skip to content

Commit a72b45d

Browse files
committed
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 moby#23459. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
1 parent ec1790d commit a72b45d

File tree

19 files changed

+42
-42
lines changed

19 files changed

+42
-42
lines changed

api/client/hijack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (cli *DockerCli) HoldHijackedConnection(ctx context.Context, tty bool, inpu
4646
_, err = stdcopy.StdCopy(outputStream, errorStream, resp.Reader)
4747
}
4848

49-
logrus.Debugf("[hijack] End of stdout")
49+
logrus.Debug("[hijack] End of stdout")
5050
receiveStdout <- err
5151
}()
5252
}
@@ -62,7 +62,7 @@ func (cli *DockerCli) HoldHijackedConnection(ctx context.Context, tty bool, inpu
6262
cli.restoreTerminal(inputStream)
6363
})
6464
}
65-
logrus.Debugf("[hijack] End of stdin")
65+
logrus.Debug("[hijack] End of stdin")
6666
}
6767

6868
if err := resp.CloseWrite(); err != nil {

api/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (s *Server) InitRouter(enableProfiler bool, routers ...router.Router) {
163163
func (s *Server) createMux() *mux.Router {
164164
m := mux.NewRouter()
165165

166-
logrus.Debugf("Registering routers")
166+
logrus.Debug("Registering routers")
167167
for _, apiRouter := range s.routers {
168168
for _, r := range apiRouter.Routes() {
169169
f := s.makeHTTPHandler(r.Handler())

cmd/dockerd/service_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ func (h *handler) Execute(_ []string, r <-chan svc.ChangeRequest, s chan<- svc.S
284284
// Wait for initialization to complete.
285285
failed := <-h.tosvc
286286
if failed {
287-
logrus.Debugf("Aborting service start due to failure during initializtion")
287+
logrus.Debug("Aborting service start due to failure during initializtion")
288288
return true, 1
289289
}
290290

291291
s <- svc.Status{State: svc.Running, Accepts: svc.AcceptStop | svc.AcceptShutdown | svc.Accepted(windows.SERVICE_ACCEPT_PARAMCHANGE)}
292-
logrus.Debugf("Service running")
292+
logrus.Debug("Service running")
293293
Loop:
294294
for {
295295
select {

container/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func AttachStreams(ctx context.Context, streamConfig *runconfig.StreamConfig, op
393393
if stdin == nil || !openStdin {
394394
return
395395
}
396-
logrus.Debugf("attach: stdin: begin")
396+
logrus.Debug("attach: stdin: begin")
397397

398398
var err error
399399
if tty {
@@ -419,7 +419,7 @@ func AttachStreams(ctx context.Context, streamConfig *runconfig.StreamConfig, op
419419
cStderr.Close()
420420
}
421421
}
422-
logrus.Debugf("attach: stdin: end")
422+
logrus.Debug("attach: stdin: end")
423423
wg.Done()
424424
}()
425425

container/health.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (s *Health) String() string {
2828
// it returns nil.
2929
func (s *Health) OpenMonitorChannel() chan struct{} {
3030
if s.stop == nil {
31-
logrus.Debugf("OpenMonitorChannel")
31+
logrus.Debug("OpenMonitorChannel")
3232
s.stop = make(chan struct{})
3333
return s.stop
3434
}
@@ -38,12 +38,12 @@ func (s *Health) OpenMonitorChannel() chan struct{} {
3838
// CloseMonitorChannel closes any existing monitor channel.
3939
func (s *Health) CloseMonitorChannel() {
4040
if s.stop != nil {
41-
logrus.Debugf("CloseMonitorChannel: waiting for probe to stop")
41+
logrus.Debug("CloseMonitorChannel: waiting for probe to stop")
4242
// This channel does not buffer. Once the write succeeds, the monitor
4343
// has read the stop request and will not make any further updates
4444
// to c.State.Health.
4545
s.stop <- struct{}{}
4646
s.stop = nil
47-
logrus.Debugf("CloseMonitorChannel done")
47+
logrus.Debug("CloseMonitorChannel done")
4848
}
4949
}

daemon/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (daemon *Daemon) containerAttach(c *container.Container, stdin io.ReadClose
114114
r, w := io.Pipe()
115115
go func() {
116116
defer w.Close()
117-
defer logrus.Debugf("Closing buffered stdin pipe")
117+
defer logrus.Debug("Closing buffered stdin pipe")
118118
io.Copy(w, stdin)
119119
}()
120120
stdinPipe = r

daemon/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R
175175
r, w := io.Pipe()
176176
go func() {
177177
defer w.Close()
178-
defer logrus.Debugf("Closing buffered stdin pipe")
178+
defer logrus.Debug("Closing buffered stdin pipe")
179179
pools.Copy(w, stdin)
180180
}()
181181
cStdin = r

daemon/graphdriver/devmapper/deviceset.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ func (devices *DeviceSet) startDeviceDeletionWorker() {
699699
return
700700
}
701701

702-
logrus.Debugf("devmapper: Worker to cleanup deleted devices started")
702+
logrus.Debug("devmapper: Worker to cleanup deleted devices started")
703703
for range devices.deletionWorkerTicker.C {
704704
devices.cleanupDeletedDevices()
705705
}
@@ -1002,15 +1002,15 @@ func (devices *DeviceSet) saveBaseDeviceUUID(baseInfo *devInfo) error {
10021002
}
10031003

10041004
func (devices *DeviceSet) createBaseImage() error {
1005-
logrus.Debugf("devmapper: Initializing base device-mapper thin volume")
1005+
logrus.Debug("devmapper: Initializing base device-mapper thin volume")
10061006

10071007
// Create initial device
10081008
info, err := devices.createRegisterDevice("")
10091009
if err != nil {
10101010
return err
10111011
}
10121012

1013-
logrus.Debugf("devmapper: Creating filesystem on base device-mapper thin volume")
1013+
logrus.Debug("devmapper: Creating filesystem on base device-mapper thin volume")
10141014

10151015
if err := devices.activateDeviceIfNeeded(info, false); err != nil {
10161016
return err
@@ -1188,7 +1188,7 @@ func (devices *DeviceSet) setupBaseImage() error {
11881188
return nil
11891189
}
11901190

1191-
logrus.Debugf("devmapper: Removing uninitialized base image")
1191+
logrus.Debug("devmapper: Removing uninitialized base image")
11921192
// If previous base device is in deferred delete state,
11931193
// that needs to be cleaned up first. So don't try
11941194
// deferred deletion.
@@ -1455,7 +1455,7 @@ func (devices *DeviceSet) refreshTransaction(DeviceID int) error {
14551455

14561456
func (devices *DeviceSet) closeTransaction() error {
14571457
if err := devices.updatePoolTransactionID(); err != nil {
1458-
logrus.Debugf("devmapper: Failed to close Transaction")
1458+
logrus.Debug("devmapper: Failed to close Transaction")
14591459
return err
14601460
}
14611461
return nil
@@ -1644,15 +1644,15 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
16441644
if !devicemapper.LibraryDeferredRemovalSupport {
16451645
return fmt.Errorf("devmapper: Deferred removal can not be enabled as libdm does not support it")
16461646
}
1647-
logrus.Debugf("devmapper: Deferred removal support enabled.")
1647+
logrus.Debug("devmapper: Deferred removal support enabled.")
16481648
devices.deferredRemove = true
16491649
}
16501650

16511651
if enableDeferredDeletion {
16521652
if !devices.deferredRemove {
16531653
return fmt.Errorf("devmapper: Deferred deletion can not be enabled as deferred removal is not enabled. Enable deferred removal using --storage-opt dm.use_deferred_removal=true parameter")
16541654
}
1655-
logrus.Debugf("devmapper: Deferred deletion support enabled.")
1655+
logrus.Debug("devmapper: Deferred deletion support enabled.")
16561656
devices.deferredDelete = true
16571657
}
16581658

@@ -1716,7 +1716,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
17161716

17171717
// If the pool doesn't exist, create it
17181718
if !poolExists && devices.thinPoolDevice == "" {
1719-
logrus.Debugf("devmapper: Pool doesn't exist. Creating it.")
1719+
logrus.Debug("devmapper: Pool doesn't exist. Creating it.")
17201720

17211721
var (
17221722
dataFile *os.File
@@ -2044,8 +2044,8 @@ func (devices *DeviceSet) DeleteDevice(hash string, syncDelete bool) error {
20442044
}
20452045

20462046
func (devices *DeviceSet) deactivatePool() error {
2047-
logrus.Debugf("devmapper: deactivatePool()")
2048-
defer logrus.Debugf("devmapper: deactivatePool END")
2047+
logrus.Debug("devmapper: deactivatePool()")
2048+
defer logrus.Debug("devmapper: deactivatePool END")
20492049
devname := devices.getPoolDevName()
20502050

20512051
devinfo, err := devicemapper.GetInfo(devname)
@@ -2304,7 +2304,7 @@ func (devices *DeviceSet) UnmountDevice(hash, mountPath string) error {
23042304
if err := syscall.Unmount(mountPath, syscall.MNT_DETACH); err != nil {
23052305
return err
23062306
}
2307-
logrus.Debugf("devmapper: Unmount done")
2307+
logrus.Debug("devmapper: Unmount done")
23082308

23092309
if err := devices.deactivateDevice(info); err != nil {
23102310
return err

daemon/graphdriver/fsdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff archive.Reader) (s
132132
options := &archive.TarOptions{UIDMaps: gdw.uidMaps,
133133
GIDMaps: gdw.gidMaps}
134134
start := time.Now().UTC()
135-
logrus.Debugf("Start untar layer")
135+
logrus.Debug("Start untar layer")
136136
if size, err = ApplyUncompressedLayer(layerFs, diff, options); err != nil {
137137
return
138138
}

daemon/health.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe)
154154
for {
155155
select {
156156
case <-stop:
157-
logrus.Debugf("Stop healthcheck monitoring (received while idle)")
157+
logrus.Debug("Stop healthcheck monitoring (received while idle)")
158158
return
159159
case <-time.After(probeInterval):
160-
logrus.Debugf("Running health check...")
160+
logrus.Debug("Running health check...")
161161
startTime := time.Now()
162162
ctx, cancelProbe := context.WithTimeout(context.Background(), probeTimeout)
163163
results := make(chan *types.HealthcheckResult)
@@ -180,7 +180,7 @@ func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe)
180180
}()
181181
select {
182182
case <-stop:
183-
logrus.Debugf("Stop healthcheck monitoring (received while probing)")
183+
logrus.Debug("Stop healthcheck monitoring (received while probing)")
184184
// Stop timeout and kill probe, but don't wait for probe to exit.
185185
cancelProbe()
186186
return
@@ -189,7 +189,7 @@ func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe)
189189
// Stop timeout
190190
cancelProbe()
191191
case <-ctx.Done():
192-
logrus.Debugf("Health check taking too long")
192+
logrus.Debug("Health check taking too long")
193193
handleProbeResult(d, c, &types.HealthcheckResult{
194194
ExitCode: -1,
195195
Output: fmt.Sprintf("Health check exceeded timeout (%v)", probeTimeout),

0 commit comments

Comments
 (0)