aiogram-logging-0.0.1
توضیحات
Simplifies sending logs from your bots to DB.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | aiogram-logging-0.0.1 |
| نام | aiogram-logging |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dmitry Keysil |
| ایمیل نویسنده | kl0opa.11@gmail.com |
| آدرس صفحه اصلی | https://github.com/dkeysil/aiogram-logging |
| آدرس اینترنتی | https://pypi.org/project/aiogram-logging/ |
| مجوز | MIT |
# aiogram-logger
---
### Simplifies sending logs from your bots to DB.

---
## Quick start with InfluxDB + Grafana
Install package from pip
```
pip install aiogram_logging
```
Prepare InlfuxDB and Grafana with this [repo](https://github.com/DKeysil/influxdb-grafana-docker-compose).
Import and create instances
```python
from aiogram_logging import Logger, InfluxSender
sender = InfluxSender(host='localhost',
db='db-name',
username='db-user',
password='db-password')
logger = Logger(sender)
```
Create StatMiddleware to logging every incoming message
```python
class StatMiddleware(BaseMiddleware):
def __init__(self):
super(StatMiddleware, self).__init__()
async def on_process_message(self, message: types.Message, data: dict):
await logger.write_logs(self._manager.bot.id, message, parse_text=True)
dp.middleware.setup(StatMiddleware())
```
Create dashboard by yourself or import from `grafana-dashboard.json`
Yeah, you can connect several bots for one InfluxDB
## TODO:
1. Explain how to manage logs from several bots in Grafana
2. Parse more different data
نیازمندی
| مقدار | نام |
|---|---|
| <3 | aiogram |
| - | aioinflux |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl aiogram-logging-0.0.1:
pip install aiogram-logging-0.0.1.whl
نصب پکیج tar.gz aiogram-logging-0.0.1:
pip install aiogram-logging-0.0.1.tar.gz