Skip to main content

Lightweight sink for Loguru that sends logs to Discord via webhook.

Project description


PyPI - Python Version PyPI - Status PyPI - Downloads

Lightweight sink for Loguru that sends logs to Discord via webhook.


Construct a handler with your preferred options, then add a new sink to Loguru.


Support is guaranteed only for Python 3.12 or greater.

Once this requirement is met, simply install via your package manager of choice.

pip install loguru-discord


The following code is a complete example which demonstrates:

  • Constructing a handler
  • Adding the handler as a Loguru sink
  • Catching an exception and firing a log
from loguru import logger
from loguru_discord import DiscordSink


    value: float = 1 / 0
except Exception as e:
    logger.opt(exception=e).error("Lorem ipsum dolor sit amet")


Upon constructing your handler, the following optional customizations are available via keyword arguments.

  • Username: Username to use for the Discord Webhook message.
  • Avatar: Image URL to use for the Discord Webhook message.
  • Embed: Toggle whether to use plain codeblock formatting or rich embeds.
  • Truncate: Toggle whether to trim lengthy logs instead of uploading as a file.
  • Suppress: Prevent specific Exception types from being sent to Discord.


Loguru-Discord follows Semantic Versioning for tagging releases of the project.


Bug fixes and optimizations are always welcome. See for details.

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

loguru_discord-1.3.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

loguru_discord-1.3.1-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page