Simplifies sending logs from your bots to DB.
Project description
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.
Import and create instances
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
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:
- Explain how to manage logs from several bots in Grafana
- Parse more different data
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 aiogram-logging-0.0.1.tar.gz.
File metadata
- Download URL: aiogram-logging-0.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d853e329e05a308d284fa882b2c8bd0b6e46b9da63c20cc731502c4c496cc97
|
|
| MD5 |
636f9dc33c2204bc56b9e5e4b2993c5b
|
|
| BLAKE2b-256 |
8632cf7b175ab0050dc443e0ec2b07b0f0fcf8592541a2a462217922782b0ec0
|
File details
Details for the file aiogram_logging-0.0.1-py3-none-any.whl.
File metadata
- Download URL: aiogram_logging-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62394eab8c7defcc0fbb472df8fe8eddefd25f7a60b8cc8cbf8b367d1ed23436
|
|
| MD5 |
c91bd449105deb27195e72f4a6ac0078
|
|
| BLAKE2b-256 |
cb4cf4b6aaea1fc0a9b907bdd36744460683b39b4b2b41dff6090d1fd3a6aff8
|