A logging handler that sends log messages to Discord via webhooks.
Project description
Discord Logger
A simple, flexible Discord logging package that sends logs to Discord channels via webhooks.
Installation
pip install discord-logger-handler
Quick Start
from discrd_logger import DiscordLogger
# Initialize the logger
logger = DiscordLogger(
webhook_url="your_discord_webhook_url",
app_name="MyApp",
min_level="DEBUG" # Optional, defaults to "DEBUG"
)
# Send logs at different levels
logger.debug("Debug message", extra_field="debug value")
logger.info("Info message", user="john_doe")
logger.warning("Warning message", system_resources="running low")
logger.error("Error message", error_code=500)
logger.critical("Critical message", affected_users=1000)
Features
- Multiple log levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Custom fields support via kwargs
- Color-coded embeds in Discord
- Fallback to standard Python logging
- Timezone-aware timestamps
- Simple and intuitive API
Configuration
The logger can be configured with the following parameters:
webhook_url: Your Discord webhook URLapp_name: Name of your application (appears in log titles)min_level: Minimum logging level to process
Examples
Basic Usage
logger = DiscordLogger("webhook_url", "MyApp")
logger.info("User logged in", user_id="123", ip="192.168.1.1")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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_logger_handler-0.1.2.tar.gz.
File metadata
- Download URL: discord_logger_handler-0.1.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d364cf0a5448d6759faa8fc4c2f92f5e21ef67dffd95e2d938b516b95c7ff44
|
|
| MD5 |
36c027eae29c9678226013f497c879f6
|
|
| BLAKE2b-256 |
7eb7e2fef39a4188f68b0d96208a7683072ef72412fa8741946087bc0cfd26ee
|
File details
Details for the file discord_logger_handler-0.1.2-py3-none-any.whl.
File metadata
- Download URL: discord_logger_handler-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
536419b172820b16877f64baf0a46e3d5682e3a27c38ef81059ddad262a3061b
|
|
| MD5 |
09ada6995787e7e4187b24caf23c6399
|
|
| BLAKE2b-256 |
eac7d8aad23362ef6c04f83ca57c3f65ff01541b5364bd70ac87a89b5f20afde
|