A Go Logger That Texts You When Things Break
Needed a way to get log alerts on my phone without setting up a full monitoring stack. Telegram has a bot API. So I wrote a Go package that wraps the standard logger and forwards anything important to a chat. Took an afternoon.
What it does
tlog is a drop-in replacement for Go's standard logger. You configure it with a Telegram bot token and chat ID, and any log message above your threshold gets forwarded to Telegram in real time. Everything else still goes to stdout as normal.
Why I built it
I run a few small services on VPS instances. Not big enough to justify Datadog or PagerDuty, but important enough that I want to know when something falls over. A Telegram message on my phone is the right level of alerting for this scale.
How it works
The package wraps Go's log package. When you call tlog.Error() or tlog.Fatal(), it writes to stdout AND sends to Telegram via their Bot API. Info and Debug only go to stdout. The Telegram call is non-blocking.
No dependencies beyond the standard library and a single HTTP POST.