Metadata-Version: 2.4
Name: telelog-py
Version: 0.1.1
Summary: Envie logs e alertas para o Telegram em 60s (Python)
Author: Zarabatana
License: MIT License
        
        Copyright (c) 2025 telelog contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/ZarabaDev/telelog
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# telelog-py

Envie logs e alertas para o Telegram em 60 segundos (Python).

## Instalação

```bash
pip install telelog-py
```

## Uso mínimo

```python
from telelog import send_telegram
send_telegram("job concluído ✅")
```

## Logging

```python
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

```bash
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.

## Requisitos

- Python >= 3.8

## Variáveis de ambiente e .env

- A biblioteca lê um arquivo `.env` do 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_TOKEN`
  - `TELEGRAM_CHAT_ID` ou `TELEGRAM_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
