aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-16 22:51:05 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-16 22:51:05 +0200
commit37c4f1b3659b60f8c22cf938af87f919c19e3cfb (patch)
tree7b2355bc4efbee7cebeba7b30296a978549666ec /src/wallet/wallet_rpc_server.cpp
parentMerge pull request #5452 (diff)
parentwallet_rpc_server: add set_log_level/set_log_categories (diff)
downloadmonero-37c4f1b3659b60f8c22cf938af87f919c19e3cfb.tar.xz
Merge pull request #5430
294e858d wallet_rpc_server: add set_log_level/set_log_categories (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 2039c6742..1dd589d41 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -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;