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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discordpy-logging-handler-0.1.0.tar.gz.
File metadata
- Download URL: discordpy-logging-handler-0.1.0.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e448418b62e32e48379168fc49c63ebac0965148b02f826817335cae1e55f1e1
|
|
| MD5 |
bef296716508e2d2138d6b865189af43
|
|
| BLAKE2b-256 |
36f2708f559f9b87eadcd081686ee3e8a63de5b8b47f61fbba301d966b47ec81
|
File details
Details for the file discordpy_logging_handler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: discordpy_logging_handler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec0e9272f81137e9babb5296c9f4b7a0876204083551c5eed9db4d1e8d0eaa59
|
|
| MD5 |
76434a49c5f0f2cf18437326544d8994
|
|
| BLAKE2b-256 |
0cec258f61f4f2120e6f41249c68c6cfba2f21d85dfb6a1b151ba1f4aae27a78
|