Loguru-Discord
Forward Loguru logs to Discord webhooks.
Loguru-Discord is a lightweight sink for Loguru that forwards logs to Discord via the Webhook API.
Features
- Plug-and-play adoption with your existing logging structure
- Configurable usernames, avatars, rich formatting, and attachments for oversized messages
- Fully type-hinted for an excellent developer experience
- Native and performant Webhook API interaction powered by Clyde
- Opt-in interception of standard library logging events, unified under Loguru
Getting Started
Installation
Install with uv (recommended):
uv add loguru-discord
Alternatively, install with pip:
pip install loguru-discord
Quick Start
Replace the placeholder with your Discord webhook URL:
from loguru import logger
from loguru_discord import DiscordSink
# Construct the Discord handler
sink: DiscordSink = DiscordSink(
"https://discord.com/api/webhooks/00000000/XXXXXXXX", rich=True
)
# Add the sink to Loguru
logger.add(sink)
# Log an exception
try:
value: float = 1 / 0
except Exception as e:
logger.opt(exception=e).error("Calculation failed")
Documentation
See the documentation for more examples and configuration options.
Releases
Loguru-Discord loosely follows Semantic Versioning for consistent, predictable releases.
Contributing
See the contributor guide to report bugs, propose features, or work on documentation.
- See
CONTRIBUTING.mdfor guidelines. - See Issues for known bugs and feature requests.
Acknowledgments
This project is not affiliated with or endorsed by Loguru or Discord in any way.
Metadata
Release files for loguru-discord 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| loguru_discord-2.2.0.tar.gz | 265.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loguru_discord-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 294.0 kB
Release files / loguru_discord-2.2.0.tar.gz
| Download URL | loguru_discord-2.2.0.tar.gz |
|---|---|
| Size | 265.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee5644af16c6ecdba162c891d5673ed61801895b8cf8fe078cfcf211069a0306
|
|
BLAKE2b-256 checksum How to use checksums |
ff05a4bfaa3df8f46ee62e3920cee189e5e5b5722b0fc3c30da35c1aaf8f3100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / loguru_discord-2.2.0-py3-none-any.whl
| Download URL | loguru_discord-2.2.0-py3-none-any.whl |
|---|---|
| Size | 28.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20e16f8e6b84f5879207de120056d709d0ac9f80973fd76740d2f5822e8942f9
|
|
BLAKE2b-256 checksum How to use checksums |
5a67385ac3212b0b3448b5e1c456bd0c97914006a167a3f46be9749a61f9cce9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|