mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
logging: re-level, redact user data at info, and key links by post id
P0 — level rework + redaction: - info now carries only lifecycle, per-post business results (sent / forwarded / copied / template applied), admin actions and anomalies (upload fallback, retry enqueue; dead-letter stays error). - Per-request detail moved to debug: message/command logging, URL extraction, fetching/fetched, link-cache hits, media-group batch sends, queue processing (enqueue/processing/completed/rescheduled), photo processing (downscale/transcode), inline queries, sensitive-tweet note. - Full user-submitted URLs and message text now appear only at debug; at info and above links are printed via the normalized cache key. P1 — request correlation: - handlers::log_key() maps a URL to its normalized post key (twitter:<id> / pixiv:<id> / bsky:<handle>/<rkey>). The whole lifecycle of one link (fetch -> send -> cache -> fallback) now logs [key=...], so multi-worker logs can be correlated by grepping the key. Convention documented in AGENTS.md.
This commit is contained in:
@@ -329,8 +329,10 @@ pub async fn fetch(url: &str) -> Result<Option<Fetched>, FetchError> {
|
||||
for attempt in 0..3u32 {
|
||||
match fetch_once(url).await {
|
||||
Ok(Some(fetched)) => {
|
||||
log::info!(
|
||||
"fetched {url}: site {} returned {} media",
|
||||
// Per-request detail: debug only, keyed by the post id.
|
||||
log::debug!(
|
||||
"fetched [key={}]: site {} returned {} media",
|
||||
cache_key(url).unwrap_or_else(|| "?".into()),
|
||||
fetched.site_name(),
|
||||
fetched.media.len()
|
||||
);
|
||||
|
||||
@@ -35,7 +35,7 @@ pub async fn fetch_from_url(url: &str) -> Result<Fetched, FetchError> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::info!("tweet {id} is sensitive; set TWITTER_AUTH_TOKEN to fetch NSFW media");
|
||||
log::debug!("tweet {id} is sensitive; set TWITTER_AUTH_TOKEN to fetch NSFW media");
|
||||
Ok(empty_fetched(url))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user