This release is a pre-release and may not be stable for production use.
tglogger
tglogger contains utilities to build and redirect logs to Telegram chat via a bot.
- It has a formatter for beautiful log messages in Telegram.
- It tends to tag common logs so that you can easily filter out related log messages.
- You can send logs to individuals, channels or groups.
- It works with Django (See badges for supported versions).
| Build | Coverage | |
|---|---|---|
| master | ||
| development |
Installing
Install via pip:
pip install tglogger
Example
tglogger contains a formatter which formats log records for Telegram chats and a handler which sends log records to a Telegram chat.
Assuming you have a logger instance:
logger = logging.getLogger(__name__)
You need to have an instance of TelegramHandler and TelegramFormatter.
from tglogger import TelegramHandler, TelegramFormatter
handler = TelegramHandler(bot_token="foo", receiver="bar")
# you can also set TELEGRAM_BOT_TOKEN and TELEGRAM_RECEIVER
# environment variables so as not to pass these on initialization
formatter = TelegramFormatter() # initialize formatter
handler.setFormatter(formatter) # inject formatter into handler
logger.addHandler(handler) # inject handler into logger
And now your log records that has level above ERROR will be sent to the chat you have defined with receiver by the bot that you have defined by bot_token.
logger.error("foo") # you will receive a message by your bot
Documentation
Documentation has more information about how to use tglogger. Refer to the documentation.
Release files for tglogger 0.1.1a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tglogger-0.1.1a3.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tglogger-0.1.1a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / tglogger-0.1.1a3.tar.gz
| Download URL | tglogger-0.1.1a3.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81f9ffa4eb5fbd5b8bc2fb94a82853f0424b754f0eb86a30781eb31bffbba8e5
|
|
BLAKE2b-256 checksum How to use checksums |
8d9e3f83846ee6c251ac76f939b4ba3d62723de1780460f43a61723d1c430c2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.10
|
Release files / tglogger-0.1.1a3-py3-none-any.whl
| Download URL | tglogger-0.1.1a3-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31d79a0e2fd78b65024a8edf1b1ace713defcc6b4502642fb8048f58c3ccf6a8
|
|
BLAKE2b-256 checksum How to use checksums |
081b38923f3e6d75cb009502680dcadd9701835002ef9e0a0ac00b1825d5479c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.10
|