Skip to main content

WIP: discordpy-logging-handler

Forward Discord bot logs to Discord Text channel.

Usage

import logging

import discord
from discordpy_logging_handler import DiscordBotHandler


LOG_TEXT_CHANNEL_ID = 1111111111111

logger = logging.getLogger(__name__)


class MyClient(discord.Client):
    async def on_ready(self):
        logger.info("Logged on as {0}!".format(self.user))

    async def on_message(self, message):
        logger.info("Message from {0.author}: {0.content}".format(message))


client = MyClient()
client.run("my token goes here")

log_channel = client.get_channel(LOG_TEXT_CHANNEL_ID)
logger.setLevel(logging.DEBUG)

handler = DiscordBotHandler(log_channel)
handler.setLevel(logging.INFO)

# add ch to logger
logger.addHandler(handler)

Metadata

Release files for discordpy-logging-handler 0.1.0

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

Source distribution (sdist)

Source distribution for discordpy-logging-handler 0.1.0
File Size Uploaded
discordpy-logging-handler-0.1.0.tar.gz 31.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for discordpy-logging-handler 0.1.0
File Interpreter ABI Platform
discordpy_logging_handler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.0 kB

Release files / discordpy-logging-handler-0.1.0.tar.gz

Download URL discordpy-logging-handler-0.1.0.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e448418b62e32e48379168fc49c63ebac0965148b02f826817335cae1e55f1e1
BLAKE2b-256 checksum
How to use checksums
36f2708f559f9b87eadcd081686ee3e8a63de5b8b47f61fbba301d966b47ec81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure

Release files / discordpy_logging_handler-0.1.0-py3-none-any.whl

Download URL discordpy_logging_handler-0.1.0-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec0e9272f81137e9babb5296c9f4b7a0876204083551c5eed9db4d1e8d0eaa59
BLAKE2b-256 checksum
How to use checksums
0cec258f61f4f2120e6f41249c68c6cfba2f21d85dfb6a1b151ba1f4aae27a78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure

Release history Release notifications | RSS feed

This release

0.1.0 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