diff --git a/pkg/dryrun/cmd.go b/pkg/dryrun/cmd.go index 2d41a1b0..4deb8cdc 100644 --- a/pkg/dryrun/cmd.go +++ b/pkg/dryrun/cmd.go @@ -18,7 +18,7 @@ type DryRunner struct { statusPath string desiredStatus string mappingsPath string - logPath string + LogPath string noColors bool fullDiffs bool } diff --git a/pkg/dryrun/dryrun.go b/pkg/dryrun/dryrun.go index ed714b7c..018cd3ca 100644 --- a/pkg/dryrun/dryrun.go +++ b/pkg/dryrun/dryrun.go @@ -370,7 +370,7 @@ func (d *DryRunner) readInputResources(cmd *cobra.Command, args []string) ( // setupLogs configures klog and the controller-runtime logger to send logs to the // path defined in the configuration. If that option is empty, logs will be discarded. func (d *DryRunner) setupLogs() error { - if d.logPath == "" { + if d.LogPath == "" { klog.SetLogger(logr.Discard()) runtime.SetLogger(logr.Discard()) @@ -380,9 +380,9 @@ func (d *DryRunner) setupLogs() error { z := zaputil.NewFlagConfig() cfg := z.GetConfig() - cfg.Level = zap.NewAtomicLevelAt(zapcore.Level(-1)) + cfg.Level = zap.NewAtomicLevelAt(zapcore.Level(-2)) cfg.Encoding = "console" - cfg.OutputPaths = []string{d.logPath} + cfg.OutputPaths = []string{d.LogPath} ctrlZap, err := cfg.Build() if err != nil { diff --git a/test/dryrun/utils.go b/test/dryrun/utils.go index 557f4ab3..ebd65101 100644 --- a/test/dryrun/utils.go +++ b/test/dryrun/utils.go @@ -8,6 +8,7 @@ import ( "embed" "errors" "io/fs" + "os" "strings" "testing" @@ -20,7 +21,9 @@ func Run(testFiles embed.FS) func(t *testing.T) { return func(t *testing.T) { t.Helper() - d := dryrun.DryRunner{} + d := dryrun.DryRunner{ + LogPath: os.Stdout.Name(), + } cmd := d.GetCmd() testout := bytes.Buffer{}