mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
rpc: return loglevels of the current subsystems
This commit is contained in:
parent
f46ae2f893
commit
8d4d3e0323
24
rpcserver.go
24
rpcserver.go
@ -7355,10 +7355,28 @@ func (r *rpcServer) DebugLevel(ctx context.Context,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate the new config level to the main config struct.
|
subLoggers := r.cfg.LogWriter.SubLoggers()
|
||||||
r.cfg.DebugLevel = req.LevelSpec
|
// Sort alphabetically by subsystem name.
|
||||||
|
var tags []string
|
||||||
|
for t := range subLoggers {
|
||||||
|
tags = append(tags, t)
|
||||||
|
}
|
||||||
|
sort.Strings(tags)
|
||||||
|
|
||||||
return &lnrpc.DebugLevelResponse{}, nil
|
// Create the log levels string.
|
||||||
|
var logLevels []string
|
||||||
|
for _, t := range tags {
|
||||||
|
logLevels = append(logLevels, fmt.Sprintf("%s=%s", t,
|
||||||
|
subLoggers[t].Level().String()))
|
||||||
|
}
|
||||||
|
logLevelsString := strings.Join(logLevels, ", ")
|
||||||
|
|
||||||
|
// Propagate the new config level to the main config struct.
|
||||||
|
r.cfg.DebugLevel = logLevelsString
|
||||||
|
|
||||||
|
return &lnrpc.DebugLevelResponse{
|
||||||
|
SubSystems: logLevelsString,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodePayReq takes an encoded payment request string and attempts to decode
|
// DecodePayReq takes an encoded payment request string and attempts to decode
|
||||||
|
Loading…
Reference in New Issue
Block a user