From 3b30067f8821c57c22a2a1b41f8914e7eb7bc29f Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 21 May 2024 18:14:44 -0700 Subject: [PATCH] Log warnings to stdout instead of stderr Currently, both stdout and stderr are redirected to a file. We want stderr to be visible on the terminal in case the release config fails, but we don't want to see the spam of warnings release config always produces. Move the warnings to stdout so they stay in the file when we start showing stderr. Test: m nothing Change-Id: Ic869675f917270a472142b6e3a4210acaad7499b --- cmd/release_config/release_config_lib/util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/release_config/release_config_lib/util.go b/cmd/release_config/release_config_lib/util.go index 040820b09..4e22a5486 100644 --- a/cmd/release_config/release_config_lib/util.go +++ b/cmd/release_config/release_config_lib/util.go @@ -149,9 +149,12 @@ func DisableWarnings() { disableWarnings = true } +// warnf will log to stdout if warnings are enabled. In make code, +// stdout is redirected to a file, so the warnings will not be shown +// in the terminal. func warnf(format string, args ...any) (n int, err error) { if !disableWarnings { - return fmt.Fprintf(os.Stderr, format, args...) + return fmt.Printf(format, args...) } return 0, nil }