Skip to main content

Simple Discord webhook logger for Python

Project description

Discord Logger

PyPI Python License

Simple Discord webhook logger for Python.


Installation

pip install baihu-discord-logger

Environment Variables (Optional)

You can configure avatars using environment variables instead of passing them in code:

  • DISCORD_OWNER_AVATAR_URL
  • DISCORD_WEBHOOK_AVATAR_URL

If these are not provided, the logger will default to None.


Set Environment Variables (Permanent Only)

Windows (PowerShell)

setx DISCORD_OWNER_AVATAR_URL "https://example.com/owner.png"
setx DISCORD_WEBHOOK_AVATAR_URL "https://example.com/webhook.png"

After setting, restart terminal or VSCode to apply changes.


Linux / macOS (bash / zsh)

Add the following lines to your shell configuration file (~/.bashrc, ~/.zshrc, or ~/.profile):

echo 'export DISCORD_OWNER_AVATAR_URL="https://example.com/owner.png"' >> ~/.bashrc
echo 'export DISCORD_WEBHOOK_AVATAR_URL="https://example.com/webhook.png"' >> ~/.bashrc

Then reload configuration:

source ~/.bashrc

(or restart your terminal if using zsh/macOS default shell)


Usage

from discord_logger import DiscordLogger

logger = DiscordLogger(webhook_url="YOUR_WEBHOOK_URL")

logger.info(title="Server", description="Server started")
logger.error(title="Database", description="Database crashed")

License

MIT License

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

baihu_discord_logger-0.1.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baihu_discord_logger-0.1.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file baihu_discord_logger-0.1.2.tar.gz.

File metadata

  • Download URL: baihu_discord_logger-0.1.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for baihu_discord_logger-0.1.2.tar.gz
Algorithm Hash digest
SHA256 66bc5bc2a7d6bbac0630f099e200776dfb43a0e888ddd02a005d510f6f4b1b70
MD5 d246de3e976e046d583824285e756c84
BLAKE2b-256 e22b93e07ba4c77daf4185458b475f9b7fbcd12d79447af468f9aee405335c8a

See more details on using hashes here.

File details

Details for the file baihu_discord_logger-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for baihu_discord_logger-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 edfdffab0f2ab24caabe41b8fd5d6935ba9e9323d16cec582c253ebc5cf59b9a
MD5 96daf2a11fb0e16f423ac5f93e84ca28
BLAKE2b-256 cd08dfb08e8868ca5998421d5dbd677fbd11b85bbac0c8530b680b1d56124269

See more details on using hashes here.

Supported by

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