aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-06-12 12:13:07 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-06-12 12:13:07 -0500
commited139efc5ddb0150ef7b0c8aa76663650c37f78f (patch)
tree71423f5f8114dd004c7445ad74d0d664064e29ce /src
parentMerge pull request #3340 (diff)
parenthandle improper log levels (diff)
downloadmonero-ed139efc5ddb0150ef7b0c8aa76663650c37f78f.tar.xz
Merge pull request #3643
e2b7558 handle improper log levels (cryptochangements34)
Diffstat (limited to 'src')
-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 397614328..223948a51 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2451,8 +2451,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;
}