feat: deprecate RPC 'debug' to favor of 'logging'

This commit is contained in:
Konstantin Akimov 2024-12-11 17:04:36 +07:00
parent 6d97441434
commit 9766cbe6ac
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -47,14 +47,10 @@
static RPCHelpMan debug() static RPCHelpMan debug()
{ {
return RPCHelpMan{"debug", return RPCHelpMan{"debug",
"Change debug category on the fly. Specify single category or use '+' to specify many.\n" "DEPRECATED. Use instead the 'logging' RPC instead.\n"
"The valid logging categories are: " + LogInstance().LogCategoriesString() + ".\n" "For 'debug all': logging [\\\"all\\\"]\n"
"libevent logging is configured on startup and cannot be modified by this RPC during runtime.\n" "For 'debug none': logging []\n"
"There are also a few meta-categories:\n" "For 'debug X+Y': logging \"[\\\"X\\\", \\\"Y\\\"]\"",
" - \"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",
{ {
{"category", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the debug category to turn on."}, {"category", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the debug category to turn on."},
}, },
@ -67,6 +63,9 @@ static RPCHelpMan debug()
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](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(); std::string strMode = request.params[0].get_str();
LogInstance().DisableCategory(BCLog::ALL); LogInstance().DisableCategory(BCLog::ALL);
@ -1512,7 +1511,6 @@ void RegisterMiscRPCCommands(CRPCTable &t)
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category actor (function) { // category actor (function)
// --------------------- ------------------------ // --------------------- ------------------------
{ "control", &debug, },
{ "control", &getmemoryinfo, }, { "control", &getmemoryinfo, },
{ "control", &logging, }, { "control", &logging, },
{ "util", &validateaddress, }, { "util", &validateaddress, },
@ -1537,6 +1535,7 @@ static const CRPCCommand commands[] =
{ "dash", &sporkupdate, }, { "dash", &sporkupdate, },
/* Not shown in help */ /* Not shown in help */
{ "hidden", &debug, },
{ "hidden", &setmocktime, }, { "hidden", &setmocktime, },
{ "hidden", &mockscheduler, }, { "hidden", &mockscheduler, },
{ "hidden", &echo, }, { "hidden", &echo, },