Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: cipd/client/cli/main.go

Issue 2986963002: [cipd] "selfupdate" command logs at Warning. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cli/main.go
diff --git a/cipd/client/cli/main.go b/cipd/client/cli/main.go
index d3e3cd6f39a78f0c59442704e3b6f62e7d8d0c0a..f59a2a06f7b6acd493b39cc90fcd99beb1bf1b18 100644
--- a/cipd/client/cli/main.go
+++ b/cipd/client/cli/main.go
@@ -109,8 +109,11 @@ func (c *cipdSubcommand) ModifyContext(ctx context.Context) context.Context {
// registerBaseFlags registers common flags used by all subcommands.
func (c *cipdSubcommand) registerBaseFlags() {
- // Set the default log level.
- c.logConfig.Level = logging.Info
+ // Minimum default logging level is Info. This accommodates subcommands that
+ // don't explicitly set the log level, resulting in the zero value (Debug).
+ if c.logConfig.Level < logging.Info {
+ c.logConfig.Level = logging.Info
+ }
c.Flags.StringVar(&c.jsonOutput, "json-output", "", "Path to write operation results to.")
c.Flags.BoolVar(&c.verbose, "verbose", false, "Enable more logging (deprecated, use -log-level=debug).")
@@ -2034,6 +2037,10 @@ func cmdSelfUpdate(params Parameters) *subcommands.Command {
LongDesc: "does an in-place upgrade to the current cipd binary",
CommandRun: func() subcommands.CommandRun {
s := &selfupdateRun{}
+
+ // By default, show a reduced number of logs unless something goes wrong.
+ s.logConfig.Level = logging.Warning
+
s.registerBaseFlags()
s.clientOptions.registerFlags(&s.Flags, params)
s.Flags.StringVar(&s.version, "version", "", "Version of the client to update to.")
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698