cmd/lncli: add parsing+dispatch for the `debuglevel` command

This commit is contained in:
Olaoluwa Osuntokun 2017-01-14 18:19:02 -08:00
parent 99c1ef6210
commit ee96052e44
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 36 additions and 0 deletions

View File

@ -920,3 +920,38 @@ func getNetworkInfo(ctx *cli.Context) error {
printRespJson(netInfo)
return nil
}
var DebugLevel = cli.Command{
Name: "debuglevel",
Usage: "debuglevel [--show|--level=<level_spec>]",
Description: "Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "show",
Usage: "if true, then the list of available sub-systems will be printed out",
},
cli.StringFlag{
Name: "level",
Usage: "the level specification to target either a coarse logging level, or granular set of specific sub-systems with loggin levels for each",
},
},
Action: debugLevel,
}
func debugLevel(ctx *cli.Context) error {
ctxb := context.Background()
client := getClient(ctx)
req := &lnrpc.DebugLevelRequest{
Show: ctx.Bool("show"),
LevelSpec: ctx.String("level"),
}
resp, err := client.DebugLevel(ctxb, req)
if err != nil {
return err
}
printRespJson(resp)
return nil
}

View File

@ -70,6 +70,7 @@ func main() {
GetNodeInfoCommand,
QueryRouteCommand,
GetNetworkInfoCommand,
DebugLevel,
}
if err := app.Run(os.Args); err != nil {