Telegram logging handler
Project description
logging2telegram
Wrapper for automatic reception of SMS-messages by sms-activate.ru
Installation
You can install or upgrade package with PIP:
$ pip install logging2telegram --upgrade
Or you can install from source with:
$ git clone https://github.com/tezmen/logging2telegram
$ cd logging2telegram
$ python setup.py install
...or install from source buth with pip
$ pip install git+https://github.com/tezmen/logging2telegram.git
Example
import logging.config
import logging
logging.config.dictConfig({
'version': 1,
'formatters': {
'tg_full': {
'class': 'log2tg.HtmlFormatter',
}
},
'handlers': {
'telegram': {
'level': 'DEBUG',
'class': 'log2tg.TelegramHandler',
'formatter': 'tg_full',
'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': {
'class': 'log2tg.HtmlFormatter',
'format': '%(message)s'
}
}
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
logging2telegram-1.0.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for logging2telegram-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbcc06e5c0b61ff52644073556416f4a7583e26253423f679bf77b3a579a8957 |
|
MD5 | f73bed261f77a698da87117649bb8813 |
|
BLAKE2b-256 | f7474127a3612e80e3a04720541aa382b6fd1ba6a36e65d72b36495dcfb85c72 |