Improve log messages.

This commit is contained in:
levlam 2021-06-27 04:36:06 +03:00
parent 4f00f445b7
commit 9664181d48

View File

@ -382,7 +382,8 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
case telegram_api::photoStrippedSize::ID: { case telegram_api::photoStrippedSize::ID: {
auto size = move_tl_object_as<telegram_api::photoStrippedSize>(size_ptr); auto size = move_tl_object_as<telegram_api::photoStrippedSize>(size_ptr);
if (format != PhotoFormat::Jpeg) { if (format != PhotoFormat::Jpeg) {
LOG(ERROR) << "Receive unexpected JPEG minithumbnail in photo of format " << format; LOG(ERROR) << "Receive unexpected JPEG minithumbnail in photo " << id << " from " << source << " of format "
<< format;
return std::move(res); return std::move(res);
} }
return size->bytes_.as_slice().str(); return size->bytes_.as_slice().str();
@ -391,7 +392,7 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
auto size = move_tl_object_as<telegram_api::photoSizeProgressive>(size_ptr); auto size = move_tl_object_as<telegram_api::photoSizeProgressive>(size_ptr);
if (size->sizes_.empty()) { if (size->sizes_.empty()) {
LOG(ERROR) << "Receive " << to_string(size); LOG(ERROR) << "Receive photo " << id << " from " << source << " with empty size " << to_string(size);
return std::move(res); return std::move(res);
} }
std::sort(size->sizes_.begin(), size->sizes_.end()); std::sort(size->sizes_.begin(), size->sizes_.end());
@ -407,7 +408,8 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
case telegram_api::photoPathSize::ID: { case telegram_api::photoPathSize::ID: {
auto size = move_tl_object_as<telegram_api::photoPathSize>(size_ptr); auto size = move_tl_object_as<telegram_api::photoPathSize>(size_ptr);
if (format != PhotoFormat::Tgs && format != PhotoFormat::Webp) { if (format != PhotoFormat::Tgs && format != PhotoFormat::Webp) {
LOG(ERROR) << "Receive unexpected SVG minithumbnail in photo of format " << format; LOG(ERROR) << "Receive unexpected SVG minithumbnail in photo " << id << " from " << source << " of format "
<< format;
return std::move(res); return std::move(res);
} }
return size->bytes_.as_slice().str(); return size->bytes_.as_slice().str();