Skip to main content

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_after do Telegram.
  • MarkdownV2/HTML: escape automático quando TELEGRAM_PARSE_MODE definido.

Segurança

Nunca commitar .env. Use .env.example como referência e secrets no CI/CD.

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telelog_py-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

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

Hashes for telelog_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 141b0d562c23288a1a0717ecd9f09b36855d581814ade2faca1eb9955a8bdd0b
MD5 c6f83f890cf4b1cabe6cbf6feca63459
BLAKE2b-256 3e48af9fc5cf48692eca54107577ed12ea2916ef0dd01dd15f88ad3be05e1857

See more details on using hashes here.

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

Hashes for telelog_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b3331e49650e7cbf0a14ac4163da5d8dd245b575fe1d23cddc8aee75f0727b8
MD5 e9932552886d3187cf9e39366aaf9b5c
BLAKE2b-256 5ad7c576f2381e3a69742f1e42b1d3e005f2d2a3bd2d5e6f1e1afd316ddf35a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page