Commit 3855200
committed
fix(#82957): route Telegram polling [diag] lines through info channel, not error
`extensions/telegram/src/monitor.ts:111` previously hard-coded:
const log = opts.runtime?.error ?? console.error;
so every line emitted by the monitor and every line bubbled from
`TelegramPollingSession.opts.log` ended up on the runtime's error
channel. Normal lifecycle diagnostics ("polling cycle started",
"rebuilding transport for next polling cycle", "waited for previous
polling session", etc.) were therefore styled as gateway errors in the
console, breaking the visual distinction between expected lifecycle
output and actual failures.
`[telegram][diag]` is the established info-level marker in this
extension. polling-session.ts:260 itself wraps incoming `info: ...`
messages into `[telegram][diag] ${msg}` before forwarding, confirming
the intent. Other extensions (twitch monitor.ts:193,
nextcloud-talk room-info.ts:105, zalo monitor.webhook.ts:146,
signal daemon.ts:96, feishu card-action.ts:155/298) consistently use
`runtime?.log` for info and `runtime?.error` for error.
Fix: split the single `log` into a dispatch that picks the channel
based on the `[telegram][diag]` prefix:
const logInfo = opts.runtime?.log ?? console.log;
const logError = opts.runtime?.error ?? console.error;
const log = (line: string) =>
(line.includes("[telegram][diag]") ? logInfo : logError)(line);
After this change, lines like "polling cycle started ..." land on the
info channel; only true failures ("Restarting polling after ...",
"reconnect delivery drain failed: ...") stay on error.1 parent 37806af commit 3855200
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
| |||
0 commit comments