Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
Show First 20 Lines • Show All 414 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < cats.size(); ++i) { | ||||
"unknown logging category " + cat); | "unknown logging category " + cat); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
static UniValue logging(const Config &config, const JSONRPCRequest &request) { | static UniValue logging(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"logging [include,...] <exclude>\n" | "logging ( <include> <exclude> )\n" | ||||
"Gets and sets the logging configuration.\n" | "Gets and sets the logging configuration.\n" | ||||
"When called without an argument, returns the list of categories " | "When called without an argument, returns the list of categories " | ||||
"that are currently being debug logged.\n" | "with status that are currently being debug logged or not.\n" | ||||
"When called with arguments, adds or removes categories from debug " | "When called with arguments, adds or removes categories from debug " | ||||
"logging.\n" | "logging and return the lists above.\n" | ||||
"The arguments are evaluated in order \"include\", \"exclude\".\n" | |||||
"If an item is both included and excluded, it will thus end up " | |||||
"being excluded.\n" | |||||
"The valid logging categories are: " + | "The valid logging categories are: " + | ||||
ListLogCategories() + | ListLogCategories() + | ||||
"\n" | "\n" | ||||
"libevent logging is configured on startup and cannot be modified " | "In addition, the following are available as category names with " | ||||
"by this RPC during runtime.\n" | "special meanings:\n" | ||||
"Arguments:\n" | " - \"all\", \"1\" : represent all logging categories.\n" | ||||
"1. \"include\" (array of strings) add debug logging for these " | " - \"none\", \"0\" : even if other logging categories are " | ||||
"categories.\n" | "specified, ignore all of them.\n" | ||||
"2. \"exclude\" (array of strings) remove debug logging for these " | "\nArguments:\n" | ||||
"categories.\n" | "1. \"include\" (array of strings, optional) A json array " | ||||
"of categories to add debug logging\n" | |||||
" [\n" | |||||
" \"category\" (string) the valid logging category\n" | |||||
" ,...\n" | |||||
" ]\n" | |||||
"2. \"exclude\" (array of strings, optional) A json array " | |||||
"of categories to remove debug logging\n" | |||||
" [\n" | |||||
" \"category\" (string) the valid logging category\n" | |||||
" ,...\n" | |||||
" ]\n" | |||||
"\nResult:\n" | "\nResult:\n" | ||||
"<categories> (string): a list of the logging categories that are " | "{ (json object where keys are the logging " | ||||
"active.\n" | "categories, and values indicates its status\n" | ||||
" \"category\": 0|1, (numeric) if being debug logged or not. " | |||||
"0:inactive, 1:active\n" | |||||
" ...\n" | |||||
"}\n" | |||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"") + | HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"") + | ||||
HelpExampleRpc("logging", "[\"all\"], \"[libevent]\"")); | HelpExampleRpc("logging", "[\"all\"], \"[libevent]\"")); | ||||
} | } | ||||
uint32_t original_log_categories = GetLogger().GetCategoryMask(); | uint32_t original_log_categories = GetLogger().GetCategoryMask(); | ||||
if (request.params.size() > 0 && request.params[0].isArray()) { | if (request.params.size() > 0 && request.params[0].isArray()) { | ||||
EnableOrDisableLogCategories(request.params[0], true); | EnableOrDisableLogCategories(request.params[0], true); | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |