Skip to main content

discord-logger

A Python logger to send information to Discord Webhooks.

Installation

Install this package via pip by executing pip install discordlogger

Usage

Basic Usage

import logging

from discordlogger import DiscordFormatter

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
h = DiscordHandler(webhook_url=URL)
h.setLevel(logging.INFO)
logger.addHandler(h)

logger.info('Hello World')

Advanced Formating

import logging

from discordlogger import DiscordFormatter, DiscordHandler

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
h = DiscordHandler(webhook_url=URL)
h.formatter = DiscordFormatter()
logger.addHandler(h)

logger.info('Hello World')
logger.warning('Warning!')
try:
    print(data['hello'])
except Exception:
    logger.exception('Exception!')
logger.critical('Emergency here!')

Filtering

import logging

from discordlogger import DiscordFormatter, DiscordLogFilter

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
h = DiscordHandler(webhook_url=URL)
h.addFilter(DiscordLogFilter())
logger.addHandler(h)

# Now this doesn't activate the discord webhook
logger.info("Hello World")

# Whereas this does
logger.info("Hello World", extra={'notify_discord': True})

Metadata

Release files for discordlogger 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discordlogger 0.0.1
File Size Uploaded
discordlogger-0.0.1.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for discordlogger 0.0.1
File Interpreter ABI Platform
discordlogger-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / discordlogger-0.0.1.tar.gz

Download URL discordlogger-0.0.1.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
71d183a0eeb53042123f8758f0dd80b04372160a7356085804210db7121a08ca
BLAKE2b-256 checksum
How to use checksums
99da0610ed3c582c293f9c0e2e858624954c597632866425de28c78e3f980750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release files / discordlogger-0.0.1-py3-none-any.whl

Download URL discordlogger-0.0.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
528314a27fe9fdd45e87ac12a516ce49f043a2184e93837d453a199f0d405806
BLAKE2b-256 checksum
How to use checksums
b78fba1b230069d0cf5cd898b26710367f6f0fad9600336eccc3b9e80ef1e147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release history Release notifications | RSS feed

0.0.2

2 release files

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page