Skip to main content

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.

N|Solid

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>'
    }
}

Release files for logging2telegram-ng 1.1.0

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

Source distribution (sdist)

Source distribution for logging2telegram-ng 1.1.0
File Size Uploaded
logging2telegram-ng-1.1.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for logging2telegram-ng 1.1.0
File Interpreter ABI Platform
logging2telegram_ng-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / logging2telegram-ng-1.1.0.tar.gz

Download URL logging2telegram-ng-1.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c58f70fc1562387b8b207361af490acd045395927724659c33e32787e296ddb3
BLAKE2b-256 checksum
How to use checksums
d46c5c3236724a0198cefb3cc5d6e2ddec6661c623b58064d4ec44741e8fa371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / logging2telegram_ng-1.1.0-py3-none-any.whl

Download URL logging2telegram_ng-1.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
321610d3c84507c90388fbe3b79159c52c3e6a86a18235d48c858d3893c601ed
BLAKE2b-256 checksum
How to use checksums
3bba831b7d544d6bf3683629c7c55f278a8dd30f8bb9be4efa3f8eee1f32f350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

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