mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
feat(log): survive a bare deployment and name what each line is about
P0 (foundation) + P1 (diagnostic depth) of the logging plan: - main.rs initializes the timed builder with a default filter of `info,hyper_util=warn,reqwest=warn`. Without RUST_LOG nothing was logged at all (env_logger falls back to `error`), so `docker run --env-file .env` was silent, and the plain `init` had no timestamps. - info-and-above lines stop printing user URLs (fetch/send failures, inline fetch, bsky's remux warnings). The full URL, the message text and the inline query move to `trace`, so a `debug` log can be handed to someone else. - Lifecycle lines name the chat and the post: sent/failed/queued plus the total `ms`, the edit prompt, the channel forward, and every queue line (`chat=` + `[key=…]` + per-attempt `ms`, dead-letters included). - Queue work is visible: `x-media`'s fetch line carries its duration (ugoira encode and HLS remux included), and the 300s sweep reports the pending count and how overdue the oldest task is — only when the queue is non-empty. - URL workers are supervised like the queue workers: a panicking worker used to die silently and shrink the pool for the rest of the process. - Degradations that still serve the user (cache/state write or read failures, a failed chat action) are `warn`, not `error`. Verified against the scripted fake-API harness: unset RUST_LOG logs info with timestamps, `debug` carries no user URL, `trace` does, a cache-hit send logs `chat=111 in 5ms`, a failing send queues and dead-letters with chat+key, and the sweep reports the pending retry.
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ Telegram only accepts ports 443/80/88/8443.
|
||||
| `LINK_CACHE_TTL_SECONDS` | Link-result cache expiry in seconds, default 604800 (7 days) |
|
||||
| `CAPTION_QUOTE_TEXT_CHARS` | **The text part** of the caption (the joined `{title}` + `{content}`) is wrapped in a collapsible blockquote once it reaches this many characters, default 200; `0` disables |
|
||||
| `DATA_DIR` | Data directory (where the SQLite `task_queue.db` lives), default `data` (relative to the working directory, created automatically) |
|
||||
| `RUST_LOG` | Log level |
|
||||
| `RUST_LOG` | Log level, default `info,hyper_util=warn,reqwest=warn` (an unset variable no longer silences the log). Recipes: `info,xmedia_bot=debug,x_media=debug` (app detail, no dependency noise) / `debug,hyper_util=off` (everything) / `trace` (also prints full links and message text — **user data**) |
|
||||
| `TELOXIDE_PROXY` | HTTP proxy (e.g. `http://127.0.0.1:10808`); applies to both the Telegram Bot API and site fetches — required on restricted networks (e.g. behind the GFW) |
|
||||
| `LOCAL_USER_ID` | UID the container runs as, default 9001 |
|
||||
| `VIRTUAL_HOST` | Public domain or IP; nginx-proxy routes by this |
|
||||
|
||||
Reference in New Issue
Block a user