dislog-3.0.0
توضیحات
Provides an interface for using a discord webhook as a logger.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | dislog-3.0.0 |
| نام | dislog |
| نسخه کتابخانه | 3.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | regulad |
| ایمیل نویسنده | regulad@regulad.xyz |
| آدرس صفحه اصلی | https://github.com/regulad/dislog |
| آدرس اینترنتی | https://pypi.org/project/dislog/ |
| مجوز | GPLv3 |
# [dislog](https://pypi.org/project/dislog/)
[](https://wakatime.com/badge/github/regulad/dislog)

[](https://results.pre-commit.ci/latest/github/regulad/dislog/master)


###### Previously [`discord-webhook-logger`](https://pypi.org/project/discord-webhook-logger/)
Provides an interface for using a Discord webhook as a logger.
Designed to abstract away webhook-specific details, such as the JSON format, and provide a simple interface for logging messages.
## Install
Simple as:
```sh
pip install dislog[discordpy]
```
You can use extras to define which implementation of `discord.py` you want to use.
* `discordpy`: `discord.py
## Example
Using `dislog` in your projects is dead simple. It behaves like any other `logging.Handler`.
For performance reasons, it even fires off a new thread for each log message, so you don't have to worry about blocking your main thread with costly HTTP requests.
```py
from dislog import DiscordWebhookHandler
from logging import *
basicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler("url", text_send_on_error="<@440468612365680650>")])
error("hi")
```

It also works with asynchronous code, simply pass the `run_async` keyword argument. This is optional and makes it use the event loop instead of a thread pool.
```py
from dislog import DiscordWebhookHandler
from logging import *
from asyncio import run, sleep, get_running_loop
async def main():
basicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler("url", event_loop=get_running_loop(), text_send_on_error="<@440468612365680650>")])
error("hi")
await sleep(1) # Give it some time to run!
run(main())
```

## Contributing
### Setup
```sh
git clone https://github.com/regulad/dislog
cd dislog
pip install -e .
pre-commit install
```
### Testing
```sh
tox
```
نیازمندی
| مقدار | نام |
|---|---|
| <4,>=3.8.4 | aiohttp |
| <3,>=1.4 | discord.py |
| - | discord.py[speed] |
| <3,>=2.27.1 | requests |
| <8,>=7.2.1 | pytest |
| <1,>=0.20.3 | pytest-asyncio |
| <2,>=1.0.1 | mypy |
| <3,>=2.28.11.13 | types-requests |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| <4,>=3.8 | Python |
نحوه نصب
نصب پکیج whl dislog-3.0.0:
pip install dislog-3.0.0.whl
نصب پکیج tar.gz dislog-3.0.0:
pip install dislog-3.0.0.tar.gz