Envie logs e alertas para o Telegram em 60s (Python)
Project description
telelog-py
Envie logs e alertas para o Telegram em 60 segundos (Python).
Instalação
pip install telelog-py
Uso mínimo
from telelog import send_telegram
send_telegram("job concluído ✅")
Logging
import logging
from telelog import TelegramLogHandler
log = logging.getLogger("myapp")
log.setLevel(logging.INFO)
log.addHandler(TelegramLogHandler())
log.error("falhou", exc_info=True)
Variáveis de ambiente
- TELEGRAM_BOT_TOKEN
- TELEGRAM_CHAT_ID ou TELEGRAM_CHAT_IDS (separados por vírgula)
- TELEGRAM_PARSE_MODE (opcional: MarkdownV2 ou HTML; padrão: texto puro)
CLI
telelog "mensagem"
Códigos de saída:
- 0: sucesso
- 1: falha de envio
- 2: uso incorreto ou configuração ausente
Comportamento
- Truncamento em 4096 caracteres com sufixo
.... - Retries (3), timeout (5s), backoff exponencial base 500ms com jitter ±20%.
- 429: respeita
retry_afterdo Telegram. - MarkdownV2/HTML: escape automático quando
TELEGRAM_PARSE_MODEdefinido.
Segurança
Nunca commitar .env. Use .env.example como referência e secrets no CI/CD.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
telelog_py-0.1.0.tar.gz
(7.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telelog_py-0.1.0.tar.gz.
File metadata
- Download URL: telelog_py-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
141b0d562c23288a1a0717ecd9f09b36855d581814ade2faca1eb9955a8bdd0b
|
|
| MD5 |
c6f83f890cf4b1cabe6cbf6feca63459
|
|
| BLAKE2b-256 |
3e48af9fc5cf48692eca54107577ed12ea2916ef0dd01dd15f88ad3be05e1857
|
File details
Details for the file telelog_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: telelog_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b3331e49650e7cbf0a14ac4163da5d8dd245b575fe1d23cddc8aee75f0727b8
|
|
| MD5 |
e9932552886d3187cf9e39366aaf9b5c
|
|
| BLAKE2b-256 |
5ad7c576f2381e3a69742f1e42b1d3e005f2d2a3bd2d5e6f1e1afd316ddf35a5
|