mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-28 00:02:12 +00:00
chore(log): align levels with the documented convention
Three places disagreed with AGENTS' own level rules: get_chat/get_chat_administrators failures during /set_channel printed at error even though the usual cause is a mistyped channel name the user fixes on the spot (error is reserved for dead letters and the like — now warn, same as other user-served degradations); the edit-before-forward callback arrival line logged at info while the sibling arrival lines for commands and inline queries log at debug (now debug, still carries the escaped payload); and the two upload-fallback lines logged at info while photo.rs's parallel degradations log at warn (now warn both — Telegram failing to fetch our media is a degradation that leaves the user served). AGENTS' convention sentence is now explicit about all three instead of the ambiguous '(fallback, retry enqueue, dead-letter is error)'.
This commit is contained in:
@@ -71,7 +71,7 @@ async fn handle_callback(
|
||||
return;
|
||||
}
|
||||
|
||||
log::info!(
|
||||
log::debug!(
|
||||
"callback from {chat_id} on prompt {prompt_message_id}: {}",
|
||||
super::log_escape(data)
|
||||
);
|
||||
|
||||
@@ -212,7 +212,7 @@ async fn set_forward_channel_handler(
|
||||
}
|
||||
let chat = match bot.get_chat(channel.clone()).await {
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
log::warn!(
|
||||
"Failed to get channel {}: {}",
|
||||
super::log_escape(&channel.to_string()),
|
||||
e
|
||||
@@ -227,13 +227,13 @@ async fn set_forward_channel_handler(
|
||||
let channel_id = chat.id.0;
|
||||
// The sender must be a channel administrator. Compare against the
|
||||
// sender's user id, NOT the chat id (they only coincide in private
|
||||
// chats, so the old check broke group usage).
|
||||
// chats), so the old check broke group usage).
|
||||
let Some(sender) = message.from.as_ref() else {
|
||||
return Err(SetForwardChannelError::NotAdmin);
|
||||
};
|
||||
match bot.get_chat_administrators(channel.clone()).await {
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
log::warn!(
|
||||
"Failed to get channel administrators {}: {}",
|
||||
super::log_escape(&channel.to_string()),
|
||||
e
|
||||
|
||||
@@ -511,7 +511,7 @@ pub async fn send_media_sequence(ctx: &AppContext<'_>, task: &Task) -> Result<Ve
|
||||
sent.extend(messages.into_iter().map(|m| m.id.0 as i64));
|
||||
}
|
||||
Err(RequestError::Api(api)) if is_media_fetch_failure(&api) || is_size_error(&api) => {
|
||||
log::info!(
|
||||
log::warn!(
|
||||
"Telegram could not fetch media for batch {idx} ({}), downloading and reuploading",
|
||||
batch
|
||||
.first()
|
||||
@@ -604,7 +604,7 @@ pub async fn send_animation(ctx: &AppContext<'_>, task: &Task) -> Result<Vec<i64
|
||||
Ok(vec![id])
|
||||
}
|
||||
Err(RequestError::Api(api)) if is_media_fetch_failure(&api) || is_size_error(&api) => {
|
||||
log::info!(
|
||||
log::warn!(
|
||||
"Telegram could not fetch animation URL, downloading and reuploading: [key={}]",
|
||||
log_key(media_url)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user