Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/dryrun/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type DryRunner struct {
statusPath string
desiredStatus string
mappingsPath string
logPath string
LogPath string
noColors bool
fullDiffs bool
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/dryrun/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion test/dryrun/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"embed"
"errors"
"io/fs"
"os"
"strings"
"testing"

Expand All @@ -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{}
Expand Down
Loading