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
Metadata
Release files for aiogram-logging 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiogram-logging-0.0.1.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiogram_logging-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / aiogram-logging-0.0.1.tar.gz
| Download URL | aiogram-logging-0.0.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d853e329e05a308d284fa882b2c8bd0b6e46b9da63c20cc731502c4c496cc97
|
|
BLAKE2b-256 checksum How to use checksums |
8632cf7b175ab0050dc443e0ec2b07b0f0fcf8592541a2a462217922782b0ec0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / aiogram_logging-0.0.1-py3-none-any.whl
| Download URL | aiogram_logging-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62394eab8c7defcc0fbb472df8fe8eddefd25f7a60b8cc8cbf8b367d1ed23436
|
|
BLAKE2b-256 checksum How to use checksums |
cb4cf4b6aaea1fc0a9b907bdd36744460683b39b4b2b41dff6090d1fd3a6aff8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|