aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcryptochangements34 <bevanoffr@gmail.com>2018-04-15 11:33:22 -0400
committercryptochangements34 <bevanoffr@gmail.com>2018-04-15 11:33:22 -0400
commite2b75586fb1ac9e9d37f1b25594d13a77b1b0e56 (patch)
treeccc377a966756a8c9be004413fc71c8ae966c614 /src
parentMerge pull request #3606 (diff)
downloadmonero-e2b75586fb1ac9e9d37f1b25594d13a77b1b0e56.tar.xz
handle improper log levels
Diffstat (limited to '')
-rw-r--r--src/simplewallet/simplewallet.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 33615ffe2..b7dc83a85 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2439,8 +2439,24 @@ bool simple_wallet::set_log(const std::vector<std::string> &args)
fail_msg_writer() << tr("usage: set_log <log_level_number_0-4> | <categories>");
return true;
}
- if (!args.empty())
- mlog_set_log(args[0].c_str());
+ if(!args.empty())
+ {
+ uint16_t level = 0;
+ if(epee::string_tools::get_xtype_from_string(level, args[0]))
+ {
+ if(4 < level)
+ {
+ fail_msg_writer() << tr("wrong number range, use: set_log <log_level_number_0-4> | <categories>");
+ return true;
+ }
+ mlog_set_log_level(level);
+ }
+ else
+ {
+ mlog_set_log(args[0].c_str());
+ }
+ }
+
success_msg_writer() << "New log categories: " << mlog_get_categories();
return true;
}