Skip to main content

Library for logging runtime errors and sending execution reports via Telegram and Email

Project description

runreporter

Библиотека для логирования ошибок и отправки отчетов по завершению выполнения.

Возможности:

  • Логирование в файл
  • Сбор последних 300 строк лога в отчет
  • Отправка отчетов в Telegram (по chat_id)
  • Отправка отчетов на Email (SMTP)
  • Флаги: отправлять ли отчеты при отсутствии ошибок; приоритетный канал (Telegram/Email)

Установка

pip install runreporter

Пример использования

from runreporter import ErrorManager, SmtpConfig

manager = ErrorManager(
    log_file_path="app.log",
    telegram_bot_token="123:ABC",
    telegram_chat_ids=[11111111, 22222222],
    smtp_config=SmtpConfig(
        host="smtp.example.com",
        port=465,
        username="user@example.com",
        password="pass",
        use_ssl=True,
        from_addr="user@example.com",
    ),
    email_recipients=["dev1@example.com", "dev2@example.com"],
    send_reports_without_errors=False,
    primary_channel="telegram",  # "telegram" или "email"
)

with manager.context(run_name="Ежедневный импорт") as log:
    log.info("Начало работы")
    # ваш код
    log.error("Ошибка обработки записи id=42")

Конфигурация

  • send_reports_without_errors: если False, отчеты будут отправляться только при наличии ошибок
  • primary_channel: "telegram" или "email" — приоритет канала; второй используется как резервный

Лицензия

MIT

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

runreporter-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

runreporter-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file runreporter-0.1.1.tar.gz.

File metadata

  • Download URL: runreporter-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for runreporter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1d60d51e66ebbcb0eb41a065e53dcaa419883683c0af3003e5035facf1ade08f
MD5 29d7894588b37b10199df78074f6658b
BLAKE2b-256 69600dbe12f7e49d16052e9aa072de5c18f66c4432b1e8568c44c69dca26034b

See more details on using hashes here.

File details

Details for the file runreporter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: runreporter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for runreporter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0666598e18444bb008c4c8391952bf33c7fa98d28a0f36f05f6455688e00d15
MD5 b2d1b4e04fbfc19b4b6afdb8469f0073
BLAKE2b-256 13c12a2e1727b78c255d4db62d3f077c789ce4efb0e76ce3f5abe4bfd3fcf90c

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