Fix new verbosity level in td_api::testSetLogTagVerbosityLevel.

GitOrigin-RevId: 1c61e124f711c87cdfe76ef76e332785a59a9ed2
This commit is contained in:
levlam 2018-10-23 17:01:56 +03:00
parent bd2433e794
commit 4852e2940b
2 changed files with 2 additions and 6 deletions

View File

@ -3404,5 +3404,5 @@ testUseUpdate = Update;
testUseError = Error;
//@description Changes verbosity level for a specified log tag; for testing only. This is an offline method. Can be called before authorization. Can be called synchronously
//@tag Logging tag to change verbosity level (one of "td_init", "update_file", "connections", "binlog", "proxy", "net_query", "td_requests", "dc", "files", "mtproto", "raw_mtproto", "fd", "actor", "buffer", "sqlite")
//@new_verbosity_level New verbosity level; 0-1023
//@new_verbosity_level New verbosity level; 1-1024
testSetLogTagVerbosityLevel tag:string new_verbosity_level:int32 = Ok;

View File

@ -6833,15 +6833,11 @@ void Td::on_request(uint64 id, td_api::testSetLogTagVerbosityLevel &request) {
}
td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::testSetLogTagVerbosityLevel &request) {
if (request.new_verbosity_level_ < 0 || request.new_verbosity_level_ > 1023) {
return td_api::make_object<td_api::error>(400, "Wrong new verbosity level");
}
int *level = get_log_verbosity_level(request.tag_);
if (level == nullptr) {
return td_api::make_object<td_api::error>(400, "Log tag is not found");
}
*level = static_cast<int>(request.new_verbosity_level_);
*level = clamp(static_cast<int>(request.new_verbosity_level_), 1, VERBOSITY_NAME(NEVER));
return td_api::make_object<td_api::ok>();
}