Logging Discord
Logging Discord is a tool that streamlines error message logging to a Discord channel. It enables the sending of tracebacks and custom specific information messages. Below, you will find details, parameters and methods, as well as usage examples.
Table of Contents
- How to Install the Package?
- How to Use the Package?
- Configuration via 'discord_config.py'
- Usage Examples
- Donations
How to Install the Package?
pip install logging_discord
How to Use the Package?
Quick Start.
from logging_discord import LogDiscord
log_discord = LogDiscord(webhook='https://your_discord_channel_webhook')
log_discord.send(log_level=1) # 0 = unknown, 1 = debug, 2 = info, 3 = warning, 4 = error, 5 = critical
Configuration with discord_config.py
You can configure the parameters of the LogDiscord class by creating a file called 'discord_config.py' at the root of the project. The 'discord_config.py' file should contain the following configurations:
Example:
channel = {
'webhook': 'https://discord.com/api/webhooks/example',
'avatar_url': 'https://i0.wp.com/www.theterminatorfans.com/wp-content/uploads/2012/09/the-terminator3.jpg?resize=900%2C450&ssl=1',
'mode': 'DEVELOPMENT',
'app_name': 'APP_TEST',
}
log_levels = {
# color legend:
# * UNKNOWN: 0 = Black
# * DEBUG: 35840 = Green
# * INFO: 2196944 = Blue
# * WARNING: 16497928 = Yellow
# * ERROR: 16729344 = Red Orange
# * CRITICAL: 12255250 = Red
0: {
'emoji': ':thinking: ',
'title': 'UNKNOWN',
'color': 0,
},
1: {'emoji': ':beetle: ', 'title': 'DEBUG', 'color': 35840},
2: {
'emoji': ':information_source: ',
'title': 'INFO',
'color': 2196944,
},
3: {
'emoji': ':warning: ',
'title': 'WARNING',
'color': 16497928,
},
4: {'emoji': ':x: ', 'title': 'ERROR', 'color': 16729344},
5: {'emoji': ':sos: ', 'title': 'CRITICAL', 'color': 12255250},
}
Usage Examples
Here are some examples of how to use the LogDiscord class:
# Creating a logger instance
logger = LogDiscord(webhook="your_webhook_url", avatar_url="avatar_url", mode="DEVELOPMENT", app_name="MyApp")
# Sending an error log with traceback
logger.send(show_traceback=True, error_message="Critical error occurred!", log_level=5)
# Sending an information log
logger.send(show_traceback=False, error_message="Operation successful.", log_level=2)
Remember to adjust the parameters according to your needs and customize error messages as necessary.
Donations
Thank you for considering supporting the project! Your help is greatly appreciated and it enables me to continue developing and maintaining the software.
Commit your work to the LORD, and your plans will succeed. Proverbs 16: 3
Metadata
Release files for logging-discord 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logging_discord-0.2.2.tar.gz | 8.3 kB | Without provenance | Details for logging_discord-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logging_discord-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for logging_discord-0.2.2-py3-none-any.whl |
Total release size: 16.5 kB
Release files / logging_discord-0.2.2.tar.gz
| Download URL | logging_discord-0.2.2.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa4604cc3271e422cebd5b9e8cad3410aa4c0549518136ce65ba501329ae522b
|
|
BLAKE2b-256 checksum How to use checksums |
a1ebf822123e445f6a2896d54fa067d4e4f5d31bbe8f86a66486bf435a57ff97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-88-generic
|
Release files / logging_discord-0.2.2-py3-none-any.whl
| Download URL | logging_discord-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8802f02ca7795c3dfd9761d275ad218a859be0dad76b051b64295f2b23b576d
|
|
BLAKE2b-256 checksum How to use checksums |
2c2c6aee17df33a6ecbde11bffd9a7d8a95ad00b3fa3ad9c8aa851ac03781ff0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-88-generic
|
Security for logging-discord 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.