diff --git a/config.go b/config.go index 18df33f713..5e61e3bc0c 100644 --- a/config.go +++ b/config.go @@ -33,7 +33,7 @@ var ( // ClientVersion is the commandline version string used to control updating // the CLI. The format is the calendar date (YYYY-MM-DD). - ClientVersion = "2025-01-09b" + ClientVersion = "2025-01-09" // Agent version to control agent rollover. The format is the calendar date // (YYYY-MM-DD). diff --git a/operations/patch.go b/operations/patch.go index eff1a21a7c..d58bda05ce 100644 --- a/operations/patch.go +++ b/operations/patch.go @@ -15,7 +15,6 @@ import ( "github.com/evergreen-ci/evergreen/util" "github.com/evergreen-ci/utility" "github.com/mongodb/grip" - "github.com/mongodb/grip/level" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -121,14 +120,6 @@ func Patch() cli.Command { Action: func(c *cli.Context) error { confPath := c.Parent().String(confFlagName) outputJSON := c.Bool(jsonFlagName) - if outputJSON { - // If outputting the patch data as JSON, suppress any non-error - // logs since the logs won't be in JSON format. Errors should - // still appear so users can diagnose issues. - l := grip.GetSender().Level() - l.Threshold = level.Error - grip.Error(errors.Wrap(grip.SetLevel(l), "increasing log level to suppress non-errors for JSON output")) - } args := c.Args() params := &patchParams{ Project: c.String(projectFlagName), @@ -266,7 +257,7 @@ func Patch() cli.Command { continue } if err = addModuleToPatch(params, args, conf, newPatch, &module, modulePath); err != nil { - grip.Errorf("Error adding module '%s' to patch: %s", module.Name, err) + grip.ErrorWhen(!outputJSON, fmt.Sprintf("Error adding module '%s' to patch: %s", module.Name, err)) } } } diff --git a/operations/patch_module.go b/operations/patch_module.go index eeb990b596..76b17b8f08 100644 --- a/operations/patch_module.go +++ b/operations/patch_module.go @@ -141,7 +141,7 @@ func addModuleToPatch(params *patchParams, args cli.Args, conf *ClientSettings, if !params.SkipConfirm { grip.Infof("Using branch '%s' for module '%s'.", module.Branch, module.Name) if diffData.patchSummary != "" { - grip.Info(diffData.patchSummary) + fmt.Println(diffData.patchSummary) } if len(diffData.fullPatch) > 0 { if !confirm("This is a summary of the module patch to be submitted. Include this module's changes?", true) { diff --git a/operations/patch_util.go b/operations/patch_util.go index ca88cf5901..c23f53110a 100644 --- a/operations/patch_util.go +++ b/operations/patch_util.go @@ -190,12 +190,8 @@ func (p *patchParams) displayPatch(ac *legacyClient, params outputPatchParams) e return err } - grip.Info("Patch successfully created.") - // This is intentionally using fmt.Println instead of grip because if the - // output is JSON, informational grip logs are suppressed. Using fmt.Println - // ensures the patch output is displayed regardless of logging - // configuration. - fmt.Println(patchDisp) + grip.InfoWhen(!params.outputJSON, "Patch successfully created.") + grip.Info(patchDisp) if len(params.patches) == 1 && p.Browse { browserCmd, err := findBrowserCommand() @@ -240,7 +236,7 @@ func findBrowserCommand() ([]string, error) { // Performs validation for patch or patch-file func (p *patchParams) validatePatchCommand(ctx context.Context, conf *ClientSettings, ac *legacyClient, comm client.Communicator) (*model.ProjectRef, error) { if err := p.loadProject(conf); err != nil { - grip.Errorf("failed to resolve project: %s\n", err) + grip.Warningf("warning - failed to set default project: %v\n", err) } // If reusing a previous definition, ignore defaults. @@ -249,7 +245,7 @@ func (p *patchParams) validatePatchCommand(ctx context.Context, conf *ClientSett } if err := p.loadParameters(conf); err != nil { - grip.Warningf("warning - failed to set default parameters: %s\n", err) + grip.Warningf("warning - failed to set default parameters: %v\n", err) } if p.Uncommitted || conf.UncommittedChanges {