Skip to content

fix(bot): log handler and middleware failures instead of printing them - #40

Merged
k0te1ch merged 2 commits into
mainfrom
fix/bot-log-instead-of-print
Aug 15, 2026
Merged

k0te1ch merged 2 commits into
mainfrom
fix/bot-log-instead-of-print

Conversation

@k0te1ch

@k0te1ch k0te1ch commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Two failure paths reported themselves with print(), so in the container they
went to stdout untagged instead of into the loguru sink everything else uses —
no level, no timestamp, invisible to log collection.

  • bot_handler.delete_pinned_service_message: a failed delete is expected
    whenever the bot lacks rights, so it's a warning rather than nothing.
  • MetricsMiddleware._save_metrics: losing the metrics file write is worth
    seeing too.

Both log with {e!r} so the exception type survives.

cli.py keeps its print() calls — it's a click entry point and those are user
output — but the alembic handler was discarding the error text it had just
caught, so it now prints the message next to the label.

k0te1ch and others added 2 commits August 15, 2026 17:39
A failed pinned-message delete and a failed metrics write both reported
themselves with print(), so in the container they landed on stdout untagged
instead of in the loguru sink the rest of the bot uses. Both now log a warning
with {e!r} so the exception type survives.

cli.py keeps its prints (click entry point, that's user output) but no longer
drops the alembic error text it caught.
@k0te1ch
k0te1ch merged commit b5ca5ed into main Aug 15, 2026
5 checks passed
@k0te1ch
k0te1ch deleted the fix/bot-log-instead-of-print branch August 15, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant