Forward Discord bot logs to Discord Text channel.
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for discordpy-logging-handler-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e448418b62e32e48379168fc49c63ebac0965148b02f826817335cae1e55f1e1 |
|
MD5 | bef296716508e2d2138d6b865189af43 |
|
BLAKE2b-256 | 36f2708f559f9b87eadcd081686ee3e8a63de5b8b47f61fbba301d966b47ec81 |
Close
Hashes for discordpy_logging_handler-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0e9272f81137e9babb5296c9f4b7a0876204083551c5eed9db4d1e8d0eaa59 |
|
MD5 | 76434a49c5f0f2cf18437326544d8994 |
|
BLAKE2b-256 | 0cec258f61f4f2120e6f41249c68c6cfba2f21d85dfb6a1b151ba1f4aae27a78 |