mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Merge pull request #1267 from oistein/log-cmd-output-to-log
logCmdOutput to logger instead of stdout
This commit is contained in:
@@ -43,7 +43,7 @@ func (task *BashTask) Run(ctx context.Context) (*TaskRunResult, error) {
|
||||
return &TaskRunResult{false, out}, fmt.Errorf("command %s failed: %s: %w", task.command, out, err)
|
||||
} else {
|
||||
if task.logCmdOutput {
|
||||
fmt.Printf("%s\n", out)
|
||||
task.logger.With("canary", task.canary).Info(string(out))
|
||||
}
|
||||
task.logger.With("canary", task.canary).Infof("command finished %s", task.command)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (task *HelmTaskv3) Run(ctx context.Context) (*TaskRunResult, error) {
|
||||
return &TaskRunResult{false, out}, fmt.Errorf("command %s failed: %s: %w", task.command, out, err)
|
||||
} else {
|
||||
if task.logCmdOutput {
|
||||
fmt.Printf("%s\n", out)
|
||||
task.logger.With("canary", task.canary).Info(string(out))
|
||||
}
|
||||
task.logger.With("canary", task.canary).Infof("command finished %v", helmCmd)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package loadtester
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
||||
@@ -57,7 +56,7 @@ func (task *CmdTask) Run(ctx context.Context) *TaskRunResult {
|
||||
task.logger.With("canary", task.canary).Errorf("command failed %s %v %s", task.command, err, out)
|
||||
} else {
|
||||
if task.logCmdOutput {
|
||||
fmt.Printf("%s\n", out)
|
||||
task.logger.With("canary", task.canary).Info(string(out))
|
||||
}
|
||||
task.logger.With("canary", task.canary).Infof("command finished %s", task.command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user