mirror of
https://github.com/monero-project/monero.git
synced 2025-08-02 18:56:12 -04:00
wallet_rpc_server: add set_log_level/set_log_categories
This commit is contained in:
parent
1b092f3a44
commit
294e858d57
5 changed files with 104 additions and 1 deletions
|
@ -4163,6 +4163,39 @@ namespace tools
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_set_log_level(const wallet_rpc::COMMAND_RPC_SET_LOG_LEVEL::request& req, wallet_rpc::COMMAND_RPC_SET_LOG_LEVEL::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
if (m_restricted)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_DENIED;
|
||||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (req.level < 0 || req.level > 4)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_INVALID_LOG_LEVEL;
|
||||
er.message = "Error: log level not valid";
|
||||
return true;
|
||||
}
|
||||
mlog_set_log_level(req.level);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_set_log_categories(const wallet_rpc::COMMAND_RPC_SET_LOG_CATEGORIES::request& req, wallet_rpc::COMMAND_RPC_SET_LOG_CATEGORIES::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
if (m_restricted)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_DENIED;
|
||||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
|
||||
mlog_set_log(req.categories.c_str());
|
||||
res.categories = mlog_get_categories();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_get_version(const wallet_rpc::COMMAND_RPC_GET_VERSION::request& req, wallet_rpc::COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
res.version = WALLET_RPC_VERSION;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue