Skip to content

Commit

Permalink
rpcsever: implement DebugLevel command
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Jan 15, 2017
1 parent 6beaa7f commit 012480b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
return nil, err
}

// TODO(roasbeef): add synced height n stuff
return &lnrpc.GetInfoResponse{
IdentityPubkey: hex.EncodeToString(idPub),
NumPendingChannels: pendingChannels,
Expand Down Expand Up @@ -1711,3 +1712,29 @@ func (r *rpcServer) DeleteAllPayments(context.Context,
func (r *rpcServer) SetAlias(context.Context, *lnrpc.SetAliasRequest) (*lnrpc.SetAliasResponse, error) {
return nil, nil
}

// DebugLevel allows a caller to programmatically set the logging verbosity of
// lnd. The logging can be targeted according to a coarse daemon-wide logging
// level, or in a granular fashion to specify the logging for a target
// sub-system.
func (r *rpcServer) DebugLevel(ctx context.Context,
req *lnrpc.DebugLevelRequest) (*lnrpc.DebugLevelResponse, error) {

// If show is set, then we simply print out the list of available
// sub-systems.
if req.Show {
return &lnrpc.DebugLevelResponse{
SubSystems: strings.Join(supportedSubsystems(), " "),
}, nil
}

rpcsLog.Infof("[debuglevel] changing debug level to: %v", req.LevelSpec)

// Otherwise, we'll attempt to set the logging level using the
// specified level spec.
if err := parseAndSetDebugLevels(req.LevelSpec); err != nil {
return nil, err
}

return &lnrpc.DebugLevelResponse{}, nil
}

0 comments on commit 012480b

Please sign in to comment.