Skip to main content
=====
Python Telegram Logger
=====

Simple logger which dispatch messages to a telegram in markdown format.
Uses a separate thread for a dispatching.
Support many chats.
Support big messages (over 4096 chars).
Support telegram API calls restrictions.


Installation
-----------

.. code-block::
pip install python-telegram-logger


Quick start
-----------

1. Configure logger with dict config:

.. code-block:: python

config = {
...
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"telegram": {
"class": "python_telegram_logger.Handler",
"token": "bot_token",
"chat_ids": [123456789, -1234567891011],

}
},
"loggers": {
"tg": {
"level": "INFO",
"handlers": ["telegram",]
}
}
}


2. Use it!

.. code-block:: python

import logging
logger = logging.getLogger("tg")

logger.info("test")

try:
raise Exception("raise!")
except Exception:
logger.exception("catch!")


3. Formatting:

- Configure a formatter using dict config, example:

.. code-block:: python

config = {
...
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"default": {
"()": "python_telegram_logger.MarkdownFormatter",
"fmt": " *%(levelname)s* _%(name)s : %(funcName)s_"
}
},
"handlers": {
"telegram": {
"class": "python_telegram_logger.Handler",
"token": "bot_token",
"chat_ids": [123456789, -1234567891011],
"formatter": "default"
}
},
"loggers": {
"tg": {
"level": "INFO",
"handlers": ["telegram",]
}
}
}

Metadata

Release files for python-telegram-logger 1.4

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

Source distribution (sdist)

Source distribution for python-telegram-logger 1.4
File Size Uploaded Provenance Actions
python-telegram-logger-1.4.tar.gz 5.1 kB Without provenance Details for python-telegram-logger-1.4.tar.gz

Release files / python-telegram-logger-1.4.tar.gz

Download URL python-telegram-logger-1.4.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0242609fc5534338b2076a950a4033acf6c919a1b851077472814fa9a97e7d58
BLAKE2b-256 checksum
How to use checksums
f999ea559e9a155696b1733e339e2da90960351e3694895f512ed145cc2f4d58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Security for python-telegram-logger 1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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