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.addFormatter(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.2

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.2
File Size Uploaded
discordlogger-0.0.2.tar.gz 2.8 kB Details

Built distribution (wheel)

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

Total release size: 6.6 kB

Release files / discordlogger-0.0.2.tar.gz

Download URL discordlogger-0.0.2.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
93ebcd2fe18e2eabe0e4d2fc2e761c96670f62b054c526d9ea1b1f6f8fbc4e4f
BLAKE2b-256 checksum
How to use checksums
62f7bf5a34b12b7a67632a53984e9e1586faad2b404e59ca5c764cbf330ee216
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.2-py3-none-any.whl

Download URL discordlogger-0.0.2-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2812ba0dfef20c02314a6c738eba86a1cf2b1a98f8493e9a005ce89f2c9077df
BLAKE2b-256 checksum
How to use checksums
38247732ec184aab95603dc8d39152d80b7ba162c926da65fe13e138bc089a91
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

This release

0.0.2 This release

2 release files

0.0.1

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