Telegram logging handler (next generation)
Project description
logging2telegram-ng
This is a fork of logging2telegram, aiming to integrate some features from telegram-logging.
Fastest and simple handler for stream logging output to telegram chats.
Installation
You can install or upgrade package with PIP:
$ pip install logging2telegram-ng --upgrade
Or you can install from source with:
$ git clone https://github.com/jmfernandez/logging2telegram-ng.git
$ cd logging2telegram-ng
$ python setup.py install
...or install from source buth with pip
$ pip install git+https://github.com/jmfernandez/logging2telegram-ng.git
Example
import logging.config
import logging
logging.config.dictConfig({
'version': 1,
'formatters': {
'tg_full_ng': {
'()': 'log2tg_ng.NgHtmlFormatter',
}
},
'handlers': {
'telegram': {
'level': 'DEBUG',
'class': 'log2tg_ng.NgTelegramHandler',
'formatter': 'tg_full_ng',
'disable_web_page_preview': True,
'token': 'BOT:TOKEN',
'ids': [123,132,321],
},
},
'loggers': {
'myapp': {
'handlers': ['telegram']
}
},
})
def show():
logger = logging.getLogger('myapp')
logger.warning('we have <b>a</b> warning')
if __name__ == '__main__':
show()
For custom formating:
'formatters': {
'tg_full': {
'()': 'log2tg_ng.NgHtmlFormatter',
'use_emoji': False,
'format': '<b>%(level)s</b> %(filename)s: %(message)s <code>%(exc_text)s</code>'
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for logging2telegram-ng-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c58f70fc1562387b8b207361af490acd045395927724659c33e32787e296ddb3 |
|
MD5 | 51871e332c8524e79ec5919e86ca65cc |
|
BLAKE2b-256 | d46c5c3236724a0198cefb3cc5d6e2ddec6661c623b58064d4ec44741e8fa371 |
Close
Hashes for logging2telegram_ng-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321610d3c84507c90388fbe3b79159c52c3e6a86a18235d48c858d3893c601ed |
|
MD5 | 8711f3aee9ad98d7169d4a930d3d8887 |
|
BLAKE2b-256 | 3bba831b7d544d6bf3683629c7c55f278a8dd30f8bb9be4efa3f8eee1f32f350 |