django-tgwarden
A production-grade Django logging handler that ships log records to a Telegram supergroup with per-severity topic routing, batching, deduplication, rate-limiting, and a non-blocking async worker.
Features:
- 🚀 Non-blocking — daemon thread + asyncio, never slows your app
- 📋 Per-level topic routing — DEBUG/INFO/WARNING/ERROR/CRITICAL each in their own forum topic
- 🔒 PII scrubbing — passwords, tokens, credit cards redacted before reaching Telegram
Installation
pip install django-tgwarden
Quick start
# settings.py
INSTALLED_APPS = [..., "tgwarden"]
TGWARDEN = {
"BOT_TOKEN": "your-bot-token",
"CHAT_ID": "-100your-supergroup-id",
"TOPICS": {
"DEBUG": 5, "INFO": 6, "WARNING": 7, "ERROR": 8, "CRITICAL": 9,
},
}
LOGGING = {
"version": 1,
"handlers": {
"telegram": {"class": "tgwarden.handlers.TelegramHandler", "level": "WARNING"},
},
"root": {"handlers": ["telegram"], "level": "WARNING"},
}
Then verify:
python manage.py tgwarden_test --message "Hello from tgwarden!"
Development
git clone https://github.com/joma-research-and-development-group/django-tgwarden.git
cd django-tgwarden
python -m venv .venv && source .venv/bin/activate
pip install -e .[dev]
pytest
License
MIT
Release files for django-tgwarden 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_tgwarden-0.1.1.tar.gz | 60.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tgwarden-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 84.5 kB
Release files / django_tgwarden-0.1.1.tar.gz
| Download URL | django_tgwarden-0.1.1.tar.gz |
|---|---|
| Size | 60.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86bbe1a3f6ea6dad24b497ddcf55696da2a387554eaf4a063fcf1b925b590927
|
|
BLAKE2b-256 checksum How to use checksums |
57b273278980fdc4cf6e98791ac38779552ffed451d1cfd2a4085e2e01d9f3b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / django_tgwarden-0.1.1-py3-none-any.whl
| Download URL | django_tgwarden-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97e9c3c5c4e0df894fcf564e18090762dc4817e7c25d931e87edac924dd33cb0
|
|
BLAKE2b-256 checksum How to use checksums |
dc021b0ec8a30c25e4679f376daf26704114299185110c90ba7094415af0b655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|