handle improper log levels

This commit is contained in:
cryptochangements34 2018-04-15 11:33:22 -04:00
parent 6f6521ad7a
commit e2b75586fb

View file

@ -2440,7 +2440,23 @@ bool simple_wallet::set_log(const std::vector<std::string> &args)
return true;
}
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;
}