From 5e02099069cee540cbafa5ce492638c1aca18d4b Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 5 May 2020 00:37:27 +0300 Subject: [PATCH] Improve logging. GitOrigin-RevId: ea4019e25d2e9413c5eed2d5dde5a7c9b58e1d1a --- td/telegram/MessageContent.cpp | 17 +++++++++++++---- td/telegram/MessagesManager.cpp | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 9208bbdba..72d9e7b31 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2295,8 +2295,12 @@ tl_object_ptr 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) { - return nullptr; + 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,8 +2309,13 @@ tl_object_ptr get_input_media(const MessageContent *co tl_object_ptr 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) { - return nullptr; + 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; } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 7d1d5a573..c6072f3c9 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -28970,7 +28970,7 @@ void MessagesManager::set_channel_pts(Dialog *d, int32 new_pts, const char *sour G()->td_db()->get_binlog_pmc()->set(get_channel_pts_key(d->dialog_id), to_string(new_pts)); } } else if (new_pts < d->pts) { - LOG(ERROR) << "Receive wrong pts " << new_pts << " in " << d->dialog_id << " . Current pts is " << d->pts; + LOG(ERROR) << "Receive wrong pts " << new_pts << " in " << d->dialog_id << ". Current pts is " << d->pts; } }