Improve ReactionType logging.

This commit is contained in:
levlam 2023-08-04 18:44:54 +03:00
parent 5558825d61
commit 905287f1ec
3 changed files with 13 additions and 7 deletions

View File

@ -519,12 +519,12 @@ unique_ptr<MessageReactions> MessageReactions::get_message_reactions(
auto reaction_type = ReactionType(reaction_count->reaction_);
if (reaction_count->count_ <= 0 || reaction_count->count_ >= MessageReaction::MAX_CHOOSE_COUNT ||
reaction_type.is_empty()) {
LOG(ERROR) << "Receive reaction " << reaction_type << " with invalid count " << reaction_count->count_;
LOG(ERROR) << "Receive " << reaction_type << " with invalid count " << reaction_count->count_;
continue;
}
if (!reaction_types.insert(reaction_type).second) {
LOG(ERROR) << "Receive duplicate reaction " << reaction_type;
LOG(ERROR) << "Receive duplicate " << reaction_type;
continue;
}
@ -537,11 +537,11 @@ unique_ptr<MessageReactions> MessageReactions::get_message_reactions(
if (peer_reaction_type == reaction_type) {
DialogId dialog_id(peer_reaction->peer_id_);
if (!dialog_id.is_valid()) {
LOG(ERROR) << "Receive invalid " << dialog_id << " as a recent chooser for reaction " << reaction_type;
LOG(ERROR) << "Receive invalid " << dialog_id << " as a recent chooser for " << reaction_type;
continue;
}
if (!recent_choosers.insert(dialog_id).second) {
LOG(ERROR) << "Receive duplicate " << dialog_id << " as a recent chooser for reaction " << reaction_type;
LOG(ERROR) << "Receive duplicate " << dialog_id << " as a recent chooser for " << reaction_type;
continue;
}
if (!td->messages_manager_->have_dialog_info(dialog_id)) {

View File

@ -126,7 +126,13 @@ bool operator==(const ReactionType &lhs, const ReactionType &rhs) {
}
StringBuilder &operator<<(StringBuilder &string_builder, const ReactionType &reaction_type) {
return string_builder << reaction_type.reaction_;
if (reaction_type.is_empty()) {
return string_builder << "empty reaction";
}
if (reaction_type.is_custom_reaction()) {
return string_builder << "custom reaction " << get_custom_emoji_id(reaction_type.reaction_);
}
return string_builder << "reaction " << reaction_type.reaction_;
}
int64 get_reaction_types_hash(const vector<ReactionType> &reaction_types) {

View File

@ -4331,11 +4331,11 @@ void StickersManager::on_get_available_reactions(
on_get_sticker_document(std::move(available_reaction->center_icon_), StickerFormat::Tgs).second;
if (!reaction.is_valid()) {
LOG(ERROR) << "Receive invalid reaction " << reaction.reaction_type_;
LOG(ERROR) << "Receive invalid " << reaction.reaction_type_;
continue;
}
if (reaction.is_premium_) {
LOG(ERROR) << "Receive premium reaction " << reaction.reaction_type_;
LOG(ERROR) << "Receive premium " << reaction.reaction_type_;
continue;
}