diff options
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r-- | src/rpc/misc.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 26bf21356e..0c93108bce 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -349,18 +349,17 @@ UniValue getmemoryinfo(const JSONRPCRequest& request) void EnableOrDisableLogCategories(UniValue cats, bool enable) { cats = cats.get_array(); for (unsigned int i = 0; i < cats.size(); ++i) { - uint32_t flag = 0; std::string cat = cats[i].get_str(); - if (!GetLogCategory(&flag, &cat)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "unknown logging category " + cat); - } - if (flag == BCLog::NONE) { - return; - } + + bool success; if (enable) { - g_logger->EnableCategory(static_cast<BCLog::LogFlags>(flag)); + success = g_logger->EnableCategory(cat); } else { - g_logger->DisableCategory(static_cast<BCLog::LogFlags>(flag)); + success = g_logger->DisableCategory(cat); + } + + if (!success) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "unknown logging category " + cat); } } } |