Simple telegram logger
Project description
=====
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)
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],
}
},
"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!")
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)
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],
}
},
"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!")
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
Close
Hashes for python-telegram-logger-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed88d470ab869a79a71fb29151c3a8fc3274e9f4f4075d7c00b92618db5ca1e8 |
|
MD5 | 6d2f0adb090557edb13073873451f2af |
|
BLAKE2b-256 | bbc3e86264cb4f67b1e8b74c236bd061d1d2d104524c3b920fa7da8584888b3d |