Skip to main content

"A simple django app to send your website's logs to multiple telegram chats"

Project description

A simple django app to send your website’s logs to multiple telegram chats

Configuration

Follow these steps to configure django-telegram-sentry in your Django project:

  1. Install the package using pip:

    pip install django-telegram-sentry
  2. Add django_telegram_sentry to your INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        ...,
        'django_telegram_sentry',
    ]
  1. Include the django_telegram_sentry in your LOGGING settings in settings.py:

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'handlers': {
            'telegram': {
                'level': 'ERROR', # Use any level above DEBUG
                'class': 'django_telegram_sentry.handler.TelegramHandler',
                'token': 'your-telegram-bot-token',
                'receiver_list': ['chat-id-1', 'chat-id-2', ...],
                # Optionally use proxies as needed:
                'proxies': {
                    'http': 'http://server_address:port',
                    'https': 'https://server_address:port'
                }
            },
        },
        'root': {
            'handlers': ['telegram', 'other-handler', ...],
            'level': 'ERROR',
        },
    }

Exceptions that occur when calling Telegram’s API will be stored in a file called telegram_errors.log.

Result

After following these steps, your Django app will send logs to the specified Telegram chats. Here’s an example of what you can expect:

example telegram log message

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

django_telegram_sentry-1.0.1.tar.gz (111.2 kB view details)

Uploaded Source

Built Distribution

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

django_telegram_sentry-1.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file django_telegram_sentry-1.0.1.tar.gz.

File metadata

  • Download URL: django_telegram_sentry-1.0.1.tar.gz
  • Upload date:
  • Size: 111.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for django_telegram_sentry-1.0.1.tar.gz
Algorithm Hash digest
SHA256 631977f8f0aad0051f6bbfe425dde26bf3f63797cafe964c2573854389ee4ac0
MD5 516c7fd42c19c9dcdd9d5fccd60b87a5
BLAKE2b-256 c052ff17f3bf8688e2d8129ee9891342fcd7c3ea4f50d5075509554c252c809e

See more details on using hashes here.

File details

Details for the file django_telegram_sentry-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_telegram_sentry-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f054064faf37603c4131d0a616066282c92dcc56a0527d5d52d3d0522ac9b25a
MD5 27b7bf2acaa609fe609955c0c8d83f52
BLAKE2b-256 5ef813714dbef818b6f68b2f7a0e42d4ba654a670ffebaaa3067d0359a47535a

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