Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
Lightweight sink for Loguru that sends logs to Discord via webhook.
License
EthanC/Loguru-Discord
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Loguru-Discord is a lightweight sink forLoguru that forwards logs toDiscord via the Webhook API.
- Plug-and-play adoption with your existing logging structure
- Highly configurable presentation, from usernames and avatars to rich formatting and truncation
- Fully type-hinted for an excellent developer experience
- Native and performant Webhook API interaction powered byClyde
Important
Loguru-Discord requires Python 3.11 or later.
Install withuv (recommended):
uv add loguru-discordAlternatively, install with pip:
pip install loguru-discordYou can integrate Loguru-Discord in just two lines:
fromloguru_discordimportDiscordSinklogger.add(DiscordSink("https://discord.com/api/webhooks/00000000/XXXXXXXX"))
All configuration is handled onDiscordSink via optional keyword arguments.
| Argument | Description | Default |
|---|---|---|
webhook_url | Discord Webhook URL to forward log events to. | N/A (Required) |
username | String to use for the Webhook username. | None (Determined by Discord) |
avatar_url | Image URL to use for the Webhook avatar. | None (Determined by Discord) |
rich | Toggle whether to use Discord Components. | False |
suppress | List of Exception types to not forward to Discord. | None |
Here’s a complete, end-to-end example using Loguru-Discord:
fromloguruimportloggerfromloguru_discordimportDiscordSink# Construct the Discord handlersink:DiscordSink=DiscordSink("https://discord.com/api/webhooks/00000000/XXXXXXXX")# Add the sink to Logurulogger.add(sink)# Log an exceptiontry:value:float=1/0exceptExceptionase:logger.opt(exception=e).error("Lorem ipsum dolor sit amet")
Loguru-Discord loosely followsSemantic Versioning for consistent, predictable releases.
Contributions are welcome—whether it’s fixing bugs or adding new features.
- See
CONTRIBUTING.mdfor guidelines. - SeeIssues for known bugs and feature requests.
This project is not affiliated with or endorsed by Loguru or Discord in any way.
About
Lightweight sink for Loguru that sends logs to Discord via webhook.
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
