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

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

Issue 2987893002: [cipd] Enable specific log level. (Closed)
Patch Set: [cipd] Enable specific log level. 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 b0e421673cbe352b56f110e3a08433c9d1da37db..d3e3cd6f39a78f0c59442704e3b6f62e7d8d0c0a 100644
--- a/cipd/client/cli/main.go
+++ b/cipd/client/cli/main.go
@@ -90,21 +90,31 @@ type cipdSubcommand struct {
subcommands.CommandRunBase
jsonOutput string
- verbose bool
+ logConfig logging.Config
+
+ // TODO(dnj): Remove "verbose" flag once all current invocations of it are
+ // cleaned up and rolled out, as it is now deprecated in favor of "logConfig".
+ verbose bool
}
// ModifyContext implements cli.ContextModificator.
func (c *cipdSubcommand) ModifyContext(ctx context.Context) context.Context {
if c.verbose {
ctx = logging.SetLevel(ctx, logging.Debug)
+ } else {
+ ctx = c.logConfig.Set(ctx)
}
return ctx
}
// registerBaseFlags registers common flags used by all subcommands.
func (c *cipdSubcommand) registerBaseFlags() {
+ // Set the default log level.
+ 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.")
+ c.Flags.BoolVar(&c.verbose, "verbose", false, "Enable more logging (deprecated, use -log-level=debug).")
+ c.logConfig.AddFlags(&c.Flags)
}
// checkArgs checks command line args.
« 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