aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-01-15 20:31:16 -0500
committerRiccardo Spagni <ric@spagni.net>2017-01-15 20:31:16 -0500
commitac7df193ca47261c2dfd91b230489e20955013a2 (patch)
treee4d312059948a0528583e7ea58d2c0b40307a494 /src/rpc
parentMerge pull request #1578 (diff)
parentChange logging to easylogging++ (diff)
downloadmonero-ac7df193ca47261c2dfd91b230489e20955013a2.tar.xz
Merge pull request #1522
5833d66f Change logging to easylogging++ (moneromooo-monero) dc98019b easylogging++: fix logging with static const header only data members (moneromooo-monero) 3b46617b easylogging++: add ELPP_DISABLE_CHECK_MACROS (moneromooo-monero) 6fe39d90 easylogging++: allow clipping a common filename prefix (moneromooo-monero) 43abf6ff easylogging++: add file-only logs (moneromooo-monero) c313bea4 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero) 0af5d168 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero) 28362847 easylogging++: allow setting thread names (moneromooo-monero) ec71ce8d easylogging++: Print thread ID in a nicer way (moneromooo-monero) 2a0bf783 easylogging++: Add logging categories (moneromooo-monero) c50bbbfe easylogging++: import upstream (moneromooo-monero)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp19
-rw-r--r--src/rpc/core_rpc_server.h2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h20
3 files changed, 33 insertions, 8 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 0cec3c26e..29c61eca2 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -678,17 +678,20 @@ namespace cryptonote
//------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_set_log_level(const COMMAND_RPC_SET_LOG_LEVEL::request& req, COMMAND_RPC_SET_LOG_LEVEL::response& res)
{
- if (req.level < LOG_LEVEL_MIN || req.level > LOG_LEVEL_MAX)
+ if (req.level < 0 || req.level > 4)
{
res.status = "Error: log level not valid";
+ return true;
}
- else
- {
- epee::log_space::log_singletone::get_set_log_detalisation_level(true, req.level);
- int otshell_utils_log_level = 100 - (req.level * 20);
- gCurrentLogger.setDebugLevel(otshell_utils_log_level);
- res.status = CORE_RPC_STATUS_OK;
- }
+ mlog_set_log_level(req.level);
+ res.status = CORE_RPC_STATUS_OK;
+ return true;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------
+ bool core_rpc_server::on_set_log_categories(const COMMAND_RPC_SET_LOG_CATEGORIES::request& req, COMMAND_RPC_SET_LOG_CATEGORIES::response& res)
+ {
+ mlog_set_categories(req.categories.c_str());
+ res.status = CORE_RPC_STATUS_OK;
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h
index 0c0668f3b..9d6ff9740 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -91,6 +91,7 @@ namespace cryptonote
MAP_URI_AUTO_JON2_IF("/get_peer_list", on_get_peer_list, COMMAND_RPC_GET_PEER_LIST, !m_restricted)
MAP_URI_AUTO_JON2_IF("/set_log_hash_rate", on_set_log_hash_rate, COMMAND_RPC_SET_LOG_HASH_RATE, !m_restricted)
MAP_URI_AUTO_JON2_IF("/set_log_level", on_set_log_level, COMMAND_RPC_SET_LOG_LEVEL, !m_restricted)
+ MAP_URI_AUTO_JON2_IF("/set_log_categories", on_set_log_categories, COMMAND_RPC_SET_LOG_CATEGORIES, !m_restricted)
MAP_URI_AUTO_JON2("/get_transaction_pool", on_get_transaction_pool, COMMAND_RPC_GET_TRANSACTION_POOL)
MAP_URI_AUTO_JON2_IF("/stop_daemon", on_stop_daemon, COMMAND_RPC_STOP_DAEMON, !m_restricted)
MAP_URI_AUTO_JON2("/getinfo", on_get_info, COMMAND_RPC_GET_INFO)
@@ -141,6 +142,7 @@ namespace cryptonote
bool on_get_peer_list(const COMMAND_RPC_GET_PEER_LIST::request& req, COMMAND_RPC_GET_PEER_LIST::response& res);
bool on_set_log_hash_rate(const COMMAND_RPC_SET_LOG_HASH_RATE::request& req, COMMAND_RPC_SET_LOG_HASH_RATE::response& res);
bool on_set_log_level(const COMMAND_RPC_SET_LOG_LEVEL::request& req, COMMAND_RPC_SET_LOG_LEVEL::response& res);
+ bool on_set_log_categories(const COMMAND_RPC_SET_LOG_CATEGORIES::request& req, COMMAND_RPC_SET_LOG_CATEGORIES::response& res);
bool on_get_transaction_pool(const COMMAND_RPC_GET_TRANSACTION_POOL::request& req, COMMAND_RPC_GET_TRANSACTION_POOL::response& res);
bool on_stop_daemon(const COMMAND_RPC_STOP_DAEMON::request& req, COMMAND_RPC_STOP_DAEMON::response& res);
bool on_out_peers(const COMMAND_RPC_OUT_PEERS::request& req, COMMAND_RPC_OUT_PEERS::response& res);
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 2530bc06d..b3aa8d901 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -909,6 +909,26 @@ namespace cryptonote
};
};
+ struct COMMAND_RPC_SET_LOG_CATEGORIES
+ {
+ struct request
+ {
+ std::string categories;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(categories)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ std::string status;
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(status)
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+
struct tx_info
{
std::string id_hash;