Skip to content

Commit e786c1b

Browse files
committed
[FAB-3443] Improve clilogging output/usage description
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 <[email protected]>
1 parent 1dfdee5 commit e786c1b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

peer/clilogging/getlevel.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func getLevelCmd(cf *LoggingCmdFactory) *cobra.Command {
2727
var loggingGetLevelCmd = &cobra.Command{
2828
Use: "getlevel <module>",
2929
Short: "Returns the logging level of the requested module logger.",
30-
Long: `Returns the logging level of the requested module logger`,
30+
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.`,
3131
RunE: func(cmd *cobra.Command, args []string) error {
3232
return getLevel(cf, cmd, args)
3333
},

peer/clilogging/setlevel.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
2626

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

0 commit comments

Comments
 (0)