Skip to main content

A small library that ships some boilerplate code needed for integrating aiogram with loguru.

Project description

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.

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

aiogram_loguru-0.1.3.tar.gz (77.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiogram_loguru-0.1.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

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

Hashes for aiogram_loguru-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a973a721e1f31ffa961e6faa0ee0db053c3e346ce396fe80aa4d299e27406b82
MD5 60e5b5bbfb6c7b24b6e66550fc0bb842
BLAKE2b-256 0c37b60932b4e5b2fd960bb8e7c8d0a64875afbded523f2071dc14431a503a81

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiogram_loguru-0.1.3.tar.gz:

Publisher: pypi-release.yml on antos07/aiogram-loguru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for aiogram_loguru-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1f1a8e106e8b7b3960487ea1b2bed4e1063f2ea74fd1cd84abb1703691465189
MD5 02b8bbacc2a5703a441a2548ea1ef360
BLAKE2b-256 c6a191bf902d59de7289393cb986b55f0d8bfcb48445dad749fbd9d8598eaa4c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page