Skip to content

Commit e632dfa

Browse files
Yanqiang Miaoruncom
authored andcommitted
Eliminate redundant parameters
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn> update Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
1 parent 4e51d8a commit e632dfa

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

container/container.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,11 @@ func (container *Container) CheckpointDir() string {
308308
}
309309

310310
// StartLogger starts a new logger driver for the container.
311-
func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) {
311+
func (container *Container) StartLogger() (logger.Logger, error) {
312+
cfg := container.HostConfig.LogConfig
312313
c, err := logger.GetLogDriver(cfg.Type)
313314
if err != nil {
314-
return nil, fmt.Errorf("Failed to get logging factory: %v", err)
315+
return nil, fmt.Errorf("failed to get logging factory: %v", err)
315316
}
316317
info := logger.Info{
317318
Config: cfg.Config,
@@ -857,9 +858,9 @@ func (container *Container) startLogging() error {
857858
return nil // do not start logging routines
858859
}
859860

860-
l, err := container.StartLogger(container.HostConfig.LogConfig)
861+
l, err := container.StartLogger()
861862
if err != nil {
862-
return fmt.Errorf("Failed to initialize logging driver: %v", err)
863+
return fmt.Errorf("failed to initialize logging driver: %v", err)
863864
}
864865

865866
copier := logger.NewCopier(map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l)

daemon/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (daemon *Daemon) getLogger(container *container.Container) (logger.Logger,
121121
if container.LogDriver != nil && container.IsRunning() {
122122
return container.LogDriver, nil
123123
}
124-
return container.StartLogger(container.HostConfig.LogConfig)
124+
return container.StartLogger()
125125
}
126126

127127
// mergeLogConfig merges the daemon log config to the container's log config if the container's log driver is not specified.

integration-cli/docker_cli_run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4480,7 +4480,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
44804480

44814481
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
44824482
c.Assert(err, checker.NotNil)
4483-
c.Assert(out, checker.Contains, "Failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
4483+
c.Assert(out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
44844484

44854485
// NGoroutines is not updated right away, so we need to wait before failing
44864486
c.Assert(waitForGoroutines(nroutines), checker.IsNil)

0 commit comments

Comments
 (0)