Skip to content

Commit

Permalink
[FAB-3443] Improve clilogging output/usage description
Browse files Browse the repository at this point in the history
This CR updates the log message for peer CLI calls to 'setlevel' to
clarify that it is using a regular expression to set the level for
multiple modules. It also updates the usage for both 'setlevel' and
'getlevel' commands. Hopefully this will help avoid confusion when
using 'getlevel', which does not currently use regular expressions
(but can be updated to do so in the future).

Change-Id: I30e7c8351dac3ed32fc19859f1f1981ccd9dc04c
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed May 3, 2017
1 parent 1dfdee5 commit e786c1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion peer/clilogging/getlevel.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func getLevelCmd(cf *LoggingCmdFactory) *cobra.Command {
var loggingGetLevelCmd = &cobra.Command{
Use: "getlevel <module>",
Short: "Returns the logging level of the requested module logger.",
Long: `Returns the logging level of the requested module logger`,
Long: `Returns the logging level of the requested module logger. Note: the module name should exactly match the name that is displayed in the logs.`,
RunE: func(cmd *cobra.Command, args []string) error {
return getLevel(cf, cmd, args)
},
Expand Down
8 changes: 4 additions & 4 deletions peer/clilogging/setlevel.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

func setLevelCmd(cf *LoggingCmdFactory) *cobra.Command {
var loggingSetLevelCmd = &cobra.Command{
Use: "setlevel <module> <log level>",
Short: "Sets the logging level of the requested module logger.",
Long: `Sets the logging level of the requested module logger`,
Use: "setlevel <module regular expression> <log level>",
Short: "Sets the logging level for all modules that match the regular expression.",
Long: `Sets the logging level for all modules that match the regular expression.`,
RunE: func(cmd *cobra.Command, args []string) error {
return setLevel(cf, cmd, args)
},
Expand All @@ -49,7 +49,7 @@ func setLevel(cf *LoggingCmdFactory, cmd *cobra.Command, args []string) (err err
if err != nil {
return err
}
logger.Infof("Log level set for peer module '%s': %s", logResponse.LogModule, logResponse.LogLevel)
logger.Infof("Log level set for peer modules matching regular expression '%s': %s", logResponse.LogModule, logResponse.LogLevel)
}
return err
}

0 comments on commit e786c1b

Please sign in to comment.