Skip to main content

aiogram-loguru

PyPI - License PyPI - Status PyPI - Version PyPI - Python Version

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.

Metadata

Release files for aiogram-loguru 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogram-loguru 0.1.3
File Size Uploaded
aiogram_loguru-0.1.3.tar.gz 77.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiogram-loguru 0.1.3
File Interpreter ABI Platform
aiogram_loguru-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 82.0 kB

Release files / aiogram_loguru-0.1.3.tar.gz

Download URL aiogram_loguru-0.1.3.tar.gz
Size 77.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a973a721e1f31ffa961e6faa0ee0db053c3e346ce396fe80aa4d299e27406b82
BLAKE2b-256 checksum
How to use checksums
0c37b60932b4e5b2fd960bb8e7c8d0a64875afbded523f2071dc14431a503a81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2025.

Transparency log

Release files / aiogram_loguru-0.1.3-py3-none-any.whl

Download URL aiogram_loguru-0.1.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f1a8e106e8b7b3960487ea1b2bed4e1063f2ea74fd1cd84abb1703691465189
BLAKE2b-256 checksum
How to use checksums
c6a191bf902d59de7289393cb986b55f0d8bfcb48445dad749fbd9d8598eaa4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page