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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord_logging_handler-0.1.0.tar.gz.
File metadata
- Download URL: discord_logging_handler-0.1.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e2ad0ab699ac23f0cf60fd060e5c789a233533e913cf06d9177c6a383c6084c
|
|
| MD5 |
1bc75bf8df8326dd7c73f101eacf6d9e
|
|
| BLAKE2b-256 |
7274c72b6815a78fa58132981f92114817c5efa26490c4e1ef30fef6ea11307a
|
File details
Details for the file discord_logging_handler-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: discord_logging_handler-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1d54fe743d1fb713b8911fb4f1facbd46bfd9ee89fc817253424211e676407c
|
|
| MD5 |
826d9280e3e4ce3a5ceafd89e3f7d634
|
|
| BLAKE2b-256 |
eecbd51a0f50580efe7ee842857faaeffe52fe7089c9fb8c897651a530b789bb
|