A small library that ships some boilerplate code needed for integrating aiogram with loguru.
Project description
aiogram-loguru
aiogram-loguru is a small library that ships some boilerplate code needed for integrating aiogram with loguru.
Features
- A sink for loguru that sends logs to a Telegram chat via a bot.
- and more features soon...
Requirements
Python 3.9+ is supported. It also requires aiogram (v3.18 or later) and loguru (v0.7.0 or later) to be installed.
Installation
pip install aiogram-loguru
Usage
You can use the sink like this:
from aiogram import Bot
from aiogram_loguru import AiogramSink
from loguru import logger
CHAT_ID = 12345 # the ID of a chat, where the logs will be sent to
bot = Bot("YOUR BOT TOKEN")
sink = AiogramSink(bot, CHAT_ID)
logger.add(sink)
Now all the logs will be sent to the selected Telegram chat. However, Telegram Bot API has rather painful limits, so you would probably want to limit the number of sent logs to the most important ones like this:
logger.add(sink, level='ERROR')
Lastly, for the sink to work, you should actually have an event loop running.
You should also await logger.complete() when your program is exiting to ensure that all logs
have been actually sent.
See the docs for details.
License
This project is licensed under the terms of the MIT license.
Project details
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_loguru-0.1.3.tar.gz.
File metadata
- Download URL: aiogram_loguru-0.1.3.tar.gz
- Upload date:
- Size: 77.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a973a721e1f31ffa961e6faa0ee0db053c3e346ce396fe80aa4d299e27406b82
|
|
| MD5 |
60e5b5bbfb6c7b24b6e66550fc0bb842
|
|
| BLAKE2b-256 |
0c37b60932b4e5b2fd960bb8e7c8d0a64875afbded523f2071dc14431a503a81
|
Provenance
The following attestation bundles were made for aiogram_loguru-0.1.3.tar.gz:
Publisher:
pypi-release.yml on antos07/aiogram-loguru
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiogram_loguru-0.1.3.tar.gz -
Subject digest:
a973a721e1f31ffa961e6faa0ee0db053c3e346ce396fe80aa4d299e27406b82 - Sigstore transparency entry: 198222832
- Sigstore integration time:
-
Permalink:
antos07/aiogram-loguru@d06a69f6e211539a361266aa6dc2b643f85340f2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/antos07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@d06a69f6e211539a361266aa6dc2b643f85340f2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiogram_loguru-0.1.3-py3-none-any.whl.
File metadata
- Download URL: aiogram_loguru-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f1a8e106e8b7b3960487ea1b2bed4e1063f2ea74fd1cd84abb1703691465189
|
|
| MD5 |
02b8bbacc2a5703a441a2548ea1ef360
|
|
| BLAKE2b-256 |
c6a191bf902d59de7289393cb986b55f0d8bfcb48445dad749fbd9d8598eaa4c
|
Provenance
The following attestation bundles were made for aiogram_loguru-0.1.3-py3-none-any.whl:
Publisher:
pypi-release.yml on antos07/aiogram-loguru
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiogram_loguru-0.1.3-py3-none-any.whl -
Subject digest:
1f1a8e106e8b7b3960487ea1b2bed4e1063f2ea74fd1cd84abb1703691465189 - Sigstore transparency entry: 198222833
- Sigstore integration time:
-
Permalink:
antos07/aiogram-loguru@d06a69f6e211539a361266aa6dc2b643f85340f2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/antos07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@d06a69f6e211539a361266aa6dc2b643f85340f2 -
Trigger Event:
release
-
Statement type: