Improve logging to PLAIN.

GitOrigin-RevId: 5fd64a3599e599a7ae27eecc284f0cd898db8aca
This commit is contained in:
levlam 2020-06-17 05:51:36 +03:00
parent eea76cdcc0
commit ce137620f5
2 changed files with 6 additions and 3 deletions

View File

@ -4380,18 +4380,18 @@ void main(int argc, char **argv) {
});
auto res = options.run(argc, argv);
if (res.is_error()) {
LOG(ERROR) << res.error();
LOG(PLAIN) << "tg_cli: " << res.error().message();
LOG(PLAIN) << options;
return;
}
if (!res.ok().empty()) {
LOG(ERROR) << "Have unexpected non-option parameters";
LOG(PLAIN) << "tg_cli: " << "Have unexpected non-option parameters";
LOG(PLAIN) << options;
return;
}
if (api_id == 0 || api_hash.empty()) {
LOG(ERROR) << "You should provide some valid api_id and api_hash";
LOG(PLAIN) << "tg_cli: " << "You should provide some valid api_id and api_hash";
LOG(PLAIN) << options;
return;
}

View File

@ -45,6 +45,9 @@ TD_THREAD_LOCAL const char *Logger::tag2_ = nullptr;
Logger::Logger(LogInterface &log, const LogOptions &options, int log_level, Slice file_name, int line_num,
Slice comment)
: Logger(log, options, log_level) {
if (log_level == VERBOSITY_NAME(PLAIN) && &options == &log_options) {
return;
}
if (!options_.add_info) {
return;
}