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

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

Issue 2987893002: [cipd] Enable specific log level. (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 b0e421673cbe352b56f110e3a08433c9d1da37db..30e7f9fc35f7609f19ec1280c7e39317660119f0 100644
--- a/cipd/client/cli/main.go
+++ b/cipd/client/cli/main.go
@@ -91,20 +91,27 @@ type cipdSubcommand struct {
jsonOutput string
verbose bool
+ logConfig logging.Config
}
// 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 debug-level logging.")
Vadim Sh. 2017/07/26 03:47:44 I think we can kill this flag. No scripts is using
dnj 2017/07/26 05:46:37 I suppose since we pin CIPD, this is a relatively
+ 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