From af4693eac7318ac485334ab84ddc44f05d2fd952 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 5 Jan 2021 12:27:29 +0100 Subject: [PATCH] Add "messages" log tag --- td/telegram/Logging.cpp | 3 ++- td/telegram/MessagesManager.cpp | 7 ++++--- td/telegram/Td.cpp | 1 + td/telegram/Td.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/td/telegram/Logging.cpp b/td/telegram/Logging.cpp index 3c0d6bbe2..73e4bab30 100644 --- a/td/telegram/Logging.cpp +++ b/td/telegram/Logging.cpp @@ -55,7 +55,8 @@ static const std::map log_tags{ ADD_TAG(proxy), ADD_TAG(net_query), ADD_TAG(td_requests), ADD_TAG(dc), ADD_TAG(file_loader), ADD_TAG(mtproto), ADD_TAG(raw_mtproto), ADD_TAG(fd), ADD_TAG(actor), ADD_TAG(sqlite), ADD_TAG(notifications), ADD_TAG(get_difference), - ADD_TAG(file_gc), ADD_TAG(config_recoverer), ADD_TAG(dns_resolver), ADD_TAG(file_references)}; + ADD_TAG(file_gc), ADD_TAG(config_recoverer), ADD_TAG(dns_resolver), ADD_TAG(file_references), + ADD_TAG(messages)}; #undef ADD_TAG Status Logging::set_current_stream(td_api::object_ptr stream) { diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 03f355c01..e0134ce17 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -52,6 +52,7 @@ #include "td/telegram/UpdatesManager.h" #include "td/telegram/Version.h" #include "td/telegram/WebPageId.h" +#include "td/telegram/Td.h" // for VERBOSITY_NAME(messages) #include "td/actor/PromiseFuture.h" #include "td/actor/SleepActor.h" @@ -6272,7 +6273,7 @@ void MessagesManager::add_pending_update(tl_object_ptr &&u // do not try to run getDifference from this function CHECK(update != nullptr); CHECK(source != nullptr); - LOG(INFO) << "Receive from " << source << " pending " << to_string(update) << "new_pts = " << new_pts + VLOG(messages) << "Receive from " << source << " pending " << to_string(update) << "new_pts = " << new_pts << ", pts_count = " << pts_count << ", force_apply = " << force_apply; if (pts_count < 0 || new_pts <= pts_count) { LOG(ERROR) << "Receive update with wrong pts = " << new_pts << " or pts_count = " << pts_count << " from " << source @@ -6378,7 +6379,7 @@ void MessagesManager::add_pending_update(tl_object_ptr &&u } if (td_->updates_manager_->running_get_difference() || !postponed_pts_updates_.empty()) { - LOG(INFO) << "Save pending update got while running getDifference from " << source; + VLOG(messages) << "Save pending update got while running getDifference from " << source; if (td_->updates_manager_->running_get_difference()) { if (!(update->get_id() == dummyUpdate::ID || update->get_id() == updateSentMessage::ID)) { LOG(ERROR) << "Failed CHECK(\"update->get_id() == dummyUpdate::ID || update->get_id() == updateSentMessage::ID\"). Postponed pts size: " << postponed_pts_updates_.size(); @@ -7205,7 +7206,7 @@ void MessagesManager::cancel_user_dialog_action(DialogId dialog_id, const Messag void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_ptr &&update, int32 new_pts, int32 pts_count, Promise &&promise, const char *source, bool is_postponed_update) { - LOG(INFO) << "Receive from " << source << " pending " << to_string(update); + VLOG(messages) << "Receive from " << source << " pending " << to_string(update); CHECK(update != nullptr); if (dialog_id.get_type() != DialogType::Channel) { if (dialog_id != DialogId() || !td_->auth_manager_->is_bot()) { diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 31bb818ec..aa30f1aae 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -144,6 +144,7 @@ namespace td { int VERBOSITY_NAME(td_init) = VERBOSITY_NAME(DEBUG) + 3; int VERBOSITY_NAME(td_requests) = VERBOSITY_NAME(INFO); +int VERBOSITY_NAME(messages) = VERBOSITY_NAME(INFO); void Td::ResultHandler::set_td(Td *new_td) { CHECK(td == nullptr); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 33963f054..9c8def7d5 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -86,6 +86,7 @@ namespace td { extern int VERBOSITY_NAME(td_init); extern int VERBOSITY_NAME(td_requests); +extern int VERBOSITY_NAME(messages); // Td may start closing after explicit "close" or "destroy" query. // Or it may start closing by itself, because authorization is lost.