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.
Requisitos
- Python >= 3.8
Variáveis de ambiente e .env
- A biblioteca lê um arquivo
.envdo diretório atual (CWD), se existir. - Variáveis já definidas no ambiente têm precedência e não são sobrescritas pelo
.env. - Necessárias:
TELEGRAM_BOT_TOKENTELEGRAM_CHAT_IDouTELEGRAM_CHAT_IDS(múltiplos separados por vírgula)
Autor & Contato
- GitHub: https://github.com/ZarabaDev
- E-mail: zaraba@zarabatech.com.br
- Site: https://zarabatech.com.br
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.1.tar.gz
(7.6 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.1.tar.gz.
File metadata
- Download URL: telelog_py-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175c38884d436ac07d867772fcbd7b722eeb9502773948603c8c4db0d6457305
|
|
| MD5 |
d4a36136f154f287fcf74a768f054478
|
|
| BLAKE2b-256 |
7e95e431b8b86bd5bbcb98392843434a2d9a27e42b93c6aa1e3f5c75579348fc
|
File details
Details for the file telelog_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: telelog_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.4 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 |
f7b438598cc09af5ba91acf10d0a913b051715ef9b777143ba866e6494e63e8d
|
|
| MD5 |
c2739ed2426967e352c0064df57bbfb5
|
|
| BLAKE2b-256 |
b19340a2b4a4b8bbc7df8395085e3c0ec05c8ccd74e0b535110f343d31582261
|