Improve logging.

GitOrigin-RevId: ea4019e25d2e9413c5eed2d5dde5a7c9b58e1d1a
This commit is contained in:
levlam 2020-05-05 00:37:27 +03:00
parent 69ddff66bc
commit 5e02099069
2 changed files with 14 additions and 5 deletions

View File

@ -2295,9 +2295,13 @@ tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *co
}
if (!was_uploaded) {
auto file_reference = FileManager::extract_file_reference(input_media);
if (file_reference == FileReferenceView::invalid_file_reference() && !force) {
if (file_reference == FileReferenceView::invalid_file_reference()) {
if (!force) {
LOG(INFO) << "File " << file_id << " has invalid file reference";
return nullptr;
}
LOG(ERROR) << "File " << file_id << " has invalid file reference, but we forced to use it";
}
}
return input_media;
}
@ -2305,9 +2309,14 @@ tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *co
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td, int32 ttl, bool force) {
auto input_media = get_input_media_impl(content, td, nullptr, nullptr, ttl);
auto file_reference = FileManager::extract_file_reference(input_media);
if (file_reference == FileReferenceView::invalid_file_reference() && !force) {
if (file_reference == FileReferenceView::invalid_file_reference()) {
auto file_id = get_message_content_upload_file_id(content);
if (!force) {
LOG(INFO) << "File " << file_id << " has invalid file reference";
return nullptr;
}
LOG(ERROR) << "File " << file_id << " has invalid file reference, but we forced to use it";
}
return input_media;
}