Log Hooks
A discord webhook logging library
There are no docs as this isn't meant to be used in bots that are sharded or log a lot. Just ping moanie#6598 on discord.py for help (ID: 691406006277898302)
Example:
import discord
import logging
import aiohttp
from loghooks import WebhookHandler
client = discord.Client() # use commands.Bot if you wish. It doesn't make a difference.
handler = WebhookHandler(
webhook_url = "webhook-url",
session = aiohttp.ClientSession()
)
@client.event
async def on_ready():
print("ready")
# actual logging stuff
logger = logging.getLogger("discord")
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
handler.setLevel(logging.INFO)
client.run("Bot Token")
Using your own functions
import discord
import logging
import aiohttp
from loghooks import WebhookHandler
from logging import LogRecord
client = discord.Client() # use commands.Bot if you wish. It doesn't make a difference.
handler = WebhookHandler(
webhook_url = "webhook-url",
session = aiohttp.ClientSession()
)
@client.event
async def on_ready():
print("ready")
async def my_custom_webhook_function(log: LogRecord):
... # handle your log here
# actual logging stuff
logger = logging.getLogger("discord")
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
handler.setLevel(logging.INFO)
handler.setCustomHandle(my_custom_webhook_function)
client.run("Bot Token")
Metadata
Release files for loghooks 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loghooks-0.2.0.tar.gz | 3.1 kB | Without provenance | Details for loghooks-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loghooks-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for loghooks-0.2.0-py3-none-any.whl |
Total release size: 6.4 kB
Release files / loghooks-0.2.0.tar.gz
| Download URL | loghooks-0.2.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a17fc00061a25d10961814941385955f2c31fa415a3a8165f778654a241350ed
|
|
BLAKE2b-256 checksum How to use checksums |
bd189c68c6caba9182a69f57302f4ed226907bac17048a867f1bddec7a5742cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Release files / loghooks-0.2.0-py3-none-any.whl
| Download URL | loghooks-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7fd30ecb3735adc1128411a2cec16ec85e96c6561660f0899a7b90a3fb13e3e
|
|
BLAKE2b-256 checksum How to use checksums |
98e57436a4b2618beacd02dc951272c03a522bf8b6ce269f184e057d0c563141
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Security for loghooks 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.