diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 2f52829..335d8e8 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -8,18 +8,15 @@ import ( ) func Run() { - // These two lines are required to suppress log output from the Argo CD repo - // server, which Kargo Render uses as a library. - // - // Without suppressing this, requests for machine-readable output (e.g. JSON) - // will be polluted with log output and attempts to parse it (e.g. by Kargo) - // will fail. - // - // This does NOT interfere with using the Kargo Render CLI's own --debug flag, - // however, choosing that will, once again, result in some amount of - // unparsable output. + // These two lines are required to suppress undesired log output from the Argo + // CD repo server, which Kargo Render uses as a library. This does NOT + // interfere with using the Kargo Render CLI's own --debug flag. os.Setenv("ARGOCD_LOG_LEVEL", "PANIC") log.SetLevel(log.PanicLevel) + // This line makes all log output go to stderr, leaving stdout for actual + // program output only. This is important for cases where machine readable + // output (e.g. JSON) is requested. + log.SetOutput(os.Stderr) cmd, err := newRootCommand() if err != nil {