From 79f86b27af46323b5f072abf36005ad82b0262b2 Mon Sep 17 00:00:00 2001 From: Mark Phelps <209477+markphelps@users.noreply.github.com> Date: Thu, 1 Dec 2022 14:01:50 -0500 Subject: [PATCH] fix: dont print to stdout using color/non json formatted output when running with JSON output logger (#1188) --- cmd/flipt/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/flipt/main.go b/cmd/flipt/main.go index b9cd2e5509..ca62b02227 100644 --- a/cmd/flipt/main.go +++ b/cmd/flipt/main.go @@ -302,10 +302,18 @@ func run(ctx context.Context, logger *zap.Logger) error { switch cv.Compare(lv) { case 0: - color.Green("You are currently running the latest version of Flipt [%s]!", cv) + if isConsole { + color.Green("You are currently running the latest version of Flipt [%s]!", cv) + } else { + logger.Info("running latest version", zap.Stringer("version", cv)) + } case -1: updateAvailable = true - color.Yellow("A newer version of Flipt exists at %s, \nplease consider updating to the latest version.", release.GetHTMLURL()) + if isConsole { + color.Yellow("A newer version of Flipt exists at %s, \nplease consider updating to the latest version.", release.GetHTMLURL()) + } else { + logger.Info("newer version available", zap.Stringer("version", lv), zap.String("url", release.GetHTMLURL())) + } } } }