Skip to main content

Python telegram logger

Project description

pytelog

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). Support telegram API calls restrictions.

Installation

pip install pytelog

Quick start

1. Configuration

config = {
    ...
    "version": 1,
    "disable_existing_loggers": False,
    "handlers": {
        "telegram": {
            "class": "pytelog.Handler",
            "token": "bot_token",
            "chat_ids": [123456789, -1234567891011],

        }
    },
    "loggers": {
        "telegram": {
            "level": "INFO",
            "handlers": ["telegram",]
        }
    }
}

2. Usage

import logging
logger = logging.getLogger("telegram")

logger.info("Message")

3. Formatting:

config = {
    ...
    "version": 1,
    "disable_existing_loggers": False,
    "formatters": {
        "telegram": {
            "()": "pytelog.MarkdownFormatter",
        }
    },
    ...
}

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pytelog-0.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page