Skip to main content

A logging handler that sends log messages to discord via webhook.

Project description

Discord Logging Handler

A Python logging handler that sends log messages to Discord via webhook with colour coded levels.

Installation

pip install discord-logging-handler

Usage

Django Example

settings.py

DISCORD_WEBHOOK_URL = os.environ.get('DISCORD_WEBHOOK_URL')

LOGGING = {
    'version': 1,
    'handlers': {
        'file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': os.path.join(BASE_DIR, 'logs/app.log'),
            'formatter': 'verbose',
        },
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        },
        'discord': {
            'level': 'INFO',
            'class': 'discord_logging_handler.handler.DiscordWebHookHandler',
            'webhook_url': DISCORD_WEBHOOK_URL
        }
    },
    'root': {
        'handlers': ['console', 'file', 'discord'],
        'level': 'INFO',
    },
    'loggers': {
        'django': {
            'handlers': ['console', 'file'],
            'level': 'CRITICAL',
            'propagate': True,
        },
        'vaultapi': {
            'handlers': ['console', 'file', 'discord'],
            'level': 'INFO',
            'propagate': False,
        },
    },
}

Environment Variable

DISCORD_WEBHOOK_URL - Your Discord webhook URL

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

discord_logging_handler-0.2.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

discord_logging_handler-0.2.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file discord_logging_handler-0.2.0.tar.gz.

File metadata

  • Download URL: discord_logging_handler-0.2.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for discord_logging_handler-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2dc83077e0bb25678e129a90e4f3bdf3f13ef7e024f612219246386c35f38687
MD5 f198bea08154aaa9734aed6aba637eb7
BLAKE2b-256 db4dc4b9e3e324abe437d03582e74ffbb8dfae0880d73b4578bb9462f7a4ab75

See more details on using hashes here.

Provenance

The following attestation bundles were made for discord_logging_handler-0.2.0.tar.gz:

Publisher: python-publish.yml on Mowhite29/discord-logging-handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file discord_logging_handler-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for discord_logging_handler-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb813512a144349f4ee70d1cb7b2bcab6b4e1279f6ca7169737a1a5b6152a6ca
MD5 9eef6249dff8885cd8f0833b48f685ec
BLAKE2b-256 6e33e71bf74be52a6d0c72cb01a197b92321d49e1be196118ce203e2ec9aaa67

See more details on using hashes here.

Provenance

The following attestation bundles were made for discord_logging_handler-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on Mowhite29/discord-logging-handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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