diff options
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r-- | src/daemon/command_parser_executor.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 7381dd06f..27f9d0fd7 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -29,6 +29,9 @@ #include "common/dns_utils.h" #include "daemon/command_parser_executor.h" +#undef MONERO_DEFAULT_LOG_CATEGORY +#define MONERO_DEFAULT_LOG_CATEGORY "daemon" + namespace daemonize { t_command_parser_executor::t_command_parser_executor( @@ -117,24 +120,24 @@ bool t_command_parser_executor::set_log_level(const std::vector<std::string>& ar { if(args.size() != 1) { - std::cout << "use: set_log <log_level_number_0-4>" << std::endl; + std::cout << "use: set_log [<log_level_number_0-4> | <categories>]" << std::endl; return true; } uint16_t l = 0; - if(!epee::string_tools::get_xtype_from_string(l, args[0])) + if(epee::string_tools::get_xtype_from_string(l, args[0])) { - std::cout << "wrong number format, use: set_log <log_level_number_0-4>" << std::endl; - return true; + if(4 < l) + { + std::cout << "wrong number range, use: set_log <log_level_number_0-4>" << std::endl; + return true; + } + return m_executor.set_log_level(l); } - - if(LOG_LEVEL_4 < l) + else { - std::cout << "wrong number range, use: set_log <log_level_number_0-4>" << std::endl; - return true; + return m_executor.set_log_categories(args.front()); } - - return m_executor.set_log_level(l); } bool t_command_parser_executor::print_height(const std::vector<std::string>& args) @@ -511,4 +514,22 @@ bool t_command_parser_executor::alt_chain_info(const std::vector<std::string>& a return m_executor.alt_chain_info(); } +bool t_command_parser_executor::print_blockchain_dynamic_stats(const std::vector<std::string>& args) +{ + if(args.size() != 1) + { + std::cout << "Exactly one parameter is needed" << std::endl; + return false; + } + + uint64_t nblocks = 0; + if(!epee::string_tools::get_xtype_from_string(nblocks, args[0]) || nblocks == 0) + { + std::cout << "wrong number of blocks" << std::endl; + return false; + } + + return m_executor.print_blockchain_dynamic_stats(nblocks); +} + } // namespace daemonize |