Skip to content

Commit

Permalink
cmd/lncli: add parsing+dispatch for the debuglevel command
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Jan 15, 2017
1 parent 99c1ef6 commit ee96052
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cmd/lncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions cmd/lncli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func main() {
GetNodeInfoCommand,
QueryRouteCommand,
GetNetworkInfoCommand,
DebugLevel,
}

if err := app.Run(os.Args); err != nil {
Expand Down

0 comments on commit ee96052

Please sign in to comment.