Merge "Use log module to determine current log level"

This commit is contained in:
Zuul 2020-08-26 14:50:32 +00:00 committed by Gerrit Code Review
commit 70250e356e
5 changed files with 10 additions and 4 deletions
pkg
bootstrap/isogen
clusterctl
log
phase

@ -71,7 +71,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings) error {
return err
}
err = generateBootstrapIso(docBundle, builder, cfg, settings.Debug)
err = generateBootstrapIso(docBundle, builder, cfg, log.DebugEnabled())
if err != nil {
return err
}

@ -61,7 +61,7 @@ func NewExecutor(cfg ifc.ExecutorConfig) (ifc.Executor, error) {
if err != nil {
return nil, err
}
client, err := NewClient(tgtPath, cfg.AirshipSettings.Debug, options)
client, err := NewClient(tgtPath, log.DebugEnabled(), options)
if err != nil {
return nil, err
}

@ -20,6 +20,7 @@ import (
"opendev.org/airship/airshipctl/pkg/config"
"opendev.org/airship/airshipctl/pkg/document"
"opendev.org/airship/airshipctl/pkg/environment"
"opendev.org/airship/airshipctl/pkg/log"
)
// Command adds a layer to clusterctl interface with airshipctl context
@ -48,7 +49,7 @@ func NewCommand(rs *environment.AirshipCTLSettings) (*Command, error) {
if err != nil {
return nil, err
}
client, err := client.NewClient(root, rs.Debug, options)
client, err := client.NewClient(root, log.DebugEnabled(), options)
if err != nil {
return nil, err
}

@ -31,6 +31,11 @@ func Init(debugFlag bool, out io.Writer) {
airshipLog.SetOutput(out)
}
// DebugEnabled returns whether the debug level is set
func DebugEnabled() bool {
return debug
}
// Debug is a wrapper for log.Debug
func Debug(v ...interface{}) {
if debug {

@ -175,7 +175,7 @@ func (p *Cmd) Exec(name string) error {
return
}
executor.Run(runCh, ifc.RunOptions{
Debug: p.Debug,
Debug: log.DebugEnabled(),
DryRun: p.DryRun,
})
}()