From e212199d8e6c91073c99e8388c859c46bd1f5c29 Mon Sep 17 00:00:00 2001 From: Matthew Nibecker Date: Thu, 29 Feb 2024 13:54:05 -0700 Subject: [PATCH] zed manage: Quiet logger if -q flag is active (#5051) --- cmd/zed/manage/command.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/zed/manage/command.go b/cmd/zed/manage/command.go index 4d2e854f81..52755ad134 100644 --- a/cmd/zed/manage/command.go +++ b/cmd/zed/manage/command.go @@ -11,6 +11,7 @@ import ( "github.com/brimdata/zed/cmd/zed/internal/lakemanage" "github.com/brimdata/zed/cmd/zed/root" "github.com/brimdata/zed/pkg/charm" + "go.uber.org/zap" "gopkg.in/yaml.v3" ) @@ -52,11 +53,14 @@ func (c *Command) Run(args []string) error { return err } defer cleanup() - logger, err := c.logFlags.Open() - if err != nil { - return err + logger := zap.NewNop() + if !c.LakeFlags.Quiet { + logger, err = c.logFlags.Open() + if err != nil { + return err + } + defer logger.Sync() } - defer logger.Sync() if c.monitor { conn, err := c.LakeFlags.Connection() if err != nil {