Skip to content

About

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

Topics

Resources

Contributing

Stars

11 stars

Watchers

1 watching

Forks

Repository files navigation

Loguru-Discord

PyPI version Supported Python versions Build status Coverage report PyPI downloads

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

Preview

Getting Started

Installation

Important

Loguru-Discord requires Python 3.11 or later.

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.

Acknowledgments

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

Contributing

Stars

11 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages