mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-09 23:56:42 +00:00
29 lines
668 B
Go
29 lines
668 B
Go
package rpc
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/btcjson"
|
|
"github.com/kaspanet/kaspad/logger"
|
|
)
|
|
|
|
// handleDebugLevel handles debugLevel commands.
|
|
func handleDebugLevel(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
|
|
c := cmd.(*btcjson.DebugLevelCmd)
|
|
|
|
// Special show command to list supported subsystems.
|
|
if c.LevelSpec == "show" {
|
|
return fmt.Sprintf("Supported subsystems %s",
|
|
logger.SupportedSubsystems()), nil
|
|
}
|
|
|
|
err := logger.ParseAndSetDebugLevels(c.LevelSpec)
|
|
if err != nil {
|
|
return nil, &btcjson.RPCError{
|
|
Code: btcjson.ErrRPCInvalidParams.Code,
|
|
Message: err.Error(),
|
|
}
|
|
}
|
|
|
|
return "Done.", nil
|
|
}
|