commands: fix debug flag in standalone mode
The -D/--debug flag was not enabling debug logging in standalone mode.
Root cause: debug.Enable() was called before dockerCli.Initialize(),
but Initialize() calls SetLogLevel("") which resets logrus level to
Info, and since options.Debug was false, it wasn't re-enabled.
Fix: Pass opt.debug to options.Debug before Initialize() so it
properly enables debug level after SetLogLevel().
Signed-off-by: Sergei Khomenkov <sergey@homenkow.ru>
This commit is contained in:
@@ -57,6 +57,7 @@ func NewRootCmd(name string, isPlugin bool, dockerCli *command.DockerCli) *cobra
|
||||
options := cliflags.NewClientOptions()
|
||||
options.InstallFlags(nflags)
|
||||
options.SetDefaultOptions(nflags)
|
||||
options.Debug = opt.debug || debug.IsEnabled()
|
||||
return dockerCli.Initialize(options)
|
||||
}
|
||||
return plugin.PersistentPreRunE(cmd, args)
|
||||
|
||||
Reference in New Issue
Block a user