Skip to content

Commit

Permalink
feat: deprecate RPC 'debug' to favor of 'logging'
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Dec 11, 2024
1 parent 6d97441 commit 9766cbe
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@
static RPCHelpMan debug()
{
return RPCHelpMan{"debug",
"Change debug category on the fly. Specify single category or use '+' to specify many.\n"
"The valid logging categories are: " + LogInstance().LogCategoriesString() + ".\n"
"libevent logging is configured on startup and cannot be modified by this RPC during runtime.\n"
"There are also a few meta-categories:\n"
" - \"all\", \"1\" and \"\" activate all categories at once;\n"
" - \"dash\" activates all Dash-specific categories at once;\n"
" - \"none\" (or \"0\") deactivates all categories at once.\n"
"Note: If specified category doesn't match any of the above, no error is thrown.\n",
"DEPRECATED. Use instead the 'logging' RPC instead.\n"
"For 'debug all': logging [\\\"all\\\"]\n"
"For 'debug none': logging []\n"
"For 'debug X+Y': logging \"[\\\"X\\\", \\\"Y\\\"]\"",
{
{"category", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the debug category to turn on."},
},
Expand All @@ -67,6 +63,9 @@ static RPCHelpMan debug()
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
if (!IsDeprecatedRPCEnabled("debug")) {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "Please use logging instead");
}

std::string strMode = request.params[0].get_str();
LogInstance().DisableCategory(BCLog::ALL);
Expand Down Expand Up @@ -1512,7 +1511,6 @@ void RegisterMiscRPCCommands(CRPCTable &t)
static const CRPCCommand commands[] =
{ // category actor (function)
// --------------------- ------------------------
{ "control", &debug, },
{ "control", &getmemoryinfo, },
{ "control", &logging, },
{ "util", &validateaddress, },
Expand All @@ -1537,6 +1535,7 @@ static const CRPCCommand commands[] =
{ "dash", &sporkupdate, },

/* Not shown in help */
{ "hidden", &debug, },
{ "hidden", &setmocktime, },
{ "hidden", &mockscheduler, },
{ "hidden", &echo, },
Expand Down

0 comments on commit 9766cbe

Please sign in to comment.