Improve logging.

GitOrigin-RevId: 00d69bf29fb339c0eaaffbf9150bc2285b56fd3b
This commit is contained in:
levlam 2019-02-20 05:37:04 +03:00
parent 47512f0838
commit 16d7278db9
2 changed files with 20 additions and 14 deletions

View File

@ -5089,12 +5089,13 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
bool need_location_bot = (flags & USER_FLAG_NEED_LOCATION_BOT) != 0;
bool has_bot_info_version = (flags & USER_FLAG_HAS_BOT_INFO_VERSION) != 0;
LOG_IF(ERROR, !can_join_groups && !is_bot) << "Receive not bot which can't join groups from " << source;
LOG_IF(ERROR, !can_join_groups && !is_bot)
<< "Receive not bot " << user_id << " which can't join groups from " << source;
LOG_IF(ERROR, can_read_all_group_messages && !is_bot)
<< "Receive not bot which can read all group messages from " << source;
LOG_IF(ERROR, is_inline_bot && !is_bot) << "Receive not bot which is inline bot from " << source;
<< "Receive not bot " << user_id << " which can read all group messages from " << source;
LOG_IF(ERROR, is_inline_bot && !is_bot) << "Receive not bot " << user_id << " which is inline bot from " << source;
LOG_IF(ERROR, need_location_bot && !is_inline_bot)
<< "Receive not inline bot which needs user location from " << source;
<< "Receive not inline bot " << user_id << " which needs user location from " << source;
if (is_received && !u->is_received) {
u->is_received = true;
@ -5115,14 +5116,17 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
has_bot_info_version = false;
}
LOG_IF(ERROR, has_bot_info_version && !is_bot) << "Receive not bot which has bot info version from " << source;
LOG_IF(ERROR, has_bot_info_version && !is_bot)
<< "Receive not bot " << user_id << " which has bot info version from " << source;
int32 bot_info_version = has_bot_info_version ? user->bot_info_version_ : -1;
if (is_verified != u->is_verified || is_bot != u->is_bot || can_join_groups != u->can_join_groups ||
can_read_all_group_messages != u->can_read_all_group_messages || restriction_reason != u->restriction_reason ||
is_inline_bot != u->is_inline_bot || inline_query_placeholder != u->inline_query_placeholder ||
need_location_bot != u->need_location_bot) {
LOG_IF(ERROR, is_bot != u->is_bot && !is_deleted && !u->is_deleted) << "User.is_bot has changed from " << source;
LOG_IF(ERROR, is_bot != u->is_bot && !is_deleted && !u->is_deleted)
<< "User.is_bot has changed for " << user_id << "/" << u->username << " from " << source << " from "
<< u->is_bot << " to " << is_bot;
u->is_verified = is_verified;
u->is_bot = is_bot;
u->can_join_groups = can_join_groups;
@ -5154,7 +5158,8 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
}
bool has_language_code = (flags & USER_FLAG_HAS_LANGUAGE_CODE) != 0;
LOG_IF(ERROR, has_language_code && !td_->auth_manager_->is_bot()) << "Receive language code from " << source;
LOG_IF(ERROR, has_language_code && !td_->auth_manager_->is_bot())
<< "Receive language code for " << user_id << " from " << source;
if (u->language_code != user->lang_code_ && !user->lang_code_.empty()) {
u->language_code = user->lang_code_;

View File

@ -2270,7 +2270,7 @@ int64 StickersManager::search_sticker_set(const string &short_name_to_search, Pr
std::pair<int32, vector<int64>> StickersManager::search_installed_sticker_sets(bool is_masks, const string &query,
int32 limit, Promise<Unit> &&promise) {
LOG(INFO) << "Search installed " << (is_masks ? "masks " : "") << "sticker sets with query = \"" << query
LOG(INFO) << "Search installed " << (is_masks ? "mask " : "") << "sticker sets with query = \"" << query
<< "\" and limit = " << limit;
if (limit < 0) {
@ -2460,14 +2460,14 @@ void StickersManager::load_installed_sticker_sets(bool is_masks, Promise<Unit> &
load_installed_sticker_sets_queries_[is_masks].push_back(std::move(promise));
if (load_installed_sticker_sets_queries_[is_masks].size() == 1u) {
if (G()->parameters().use_file_db) {
LOG(INFO) << "Trying to load installed " << (is_masks ? "masks " : "") << "sticker sets from database";
LOG(INFO) << "Trying to load installed " << (is_masks ? "mask " : "") << "sticker sets from database";
G()->td_db()->get_sqlite_pmc()->get(is_masks ? "sss1" : "sss0", PromiseCreator::lambda([is_masks](string value) {
send_closure(G()->stickers_manager(),
&StickersManager::on_load_installed_sticker_sets_from_database,
is_masks, std::move(value));
}));
} else {
LOG(INFO) << "Trying to load installed " << (is_masks ? "masks " : "") << "sticker sets from server";
LOG(INFO) << "Trying to load installed " << (is_masks ? "mask " : "") << "sticker sets from server";
reload_installed_sticker_sets(is_masks, true);
}
}
@ -2529,14 +2529,15 @@ void StickersManager::on_load_installed_sticker_sets_finished(bool is_masks, vec
}
}
if (need_reload) {
LOG(ERROR) << "Reload installed " << (is_masks ? "masks " : "") << "sticker sets, because only "
LOG(ERROR) << "Reload installed " << (is_masks ? "mask " : "") << "sticker sets, because only "
<< installed_sticker_set_ids_[is_masks].size() << " of " << installed_sticker_set_ids.size()
<< " are really installed";
<< " are really installed after loading from " << (from_database ? "database" : "server");
reload_installed_sticker_sets(is_masks, true);
} else if (!old_installed_sticker_set_ids.empty() &&
old_installed_sticker_set_ids != installed_sticker_set_ids_[is_masks]) {
LOG(ERROR) << "Reload installed " << (is_masks ? "masks " : "") << "sticker sets, because they has changed from "
<< old_installed_sticker_set_ids << " to " << installed_sticker_set_ids_[is_masks];
LOG(ERROR) << "Reload installed " << (is_masks ? "mask " : "") << "sticker sets, because they has changed from "
<< old_installed_sticker_set_ids << " to " << installed_sticker_set_ids_[is_masks]
<< " after loading from " << (from_database ? "database" : "server");
reload_installed_sticker_sets(is_masks, true);
}