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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file pytelog-0.1-py3-none-any.whl.

File metadata

  • Download URL: pytelog-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for pytelog-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4e134161e6f258d89907f52b67816b83cc6ff436b3321d78ff7310bd15232e
MD5 e6bb29749c20d91c84df73929cdfe05e
BLAKE2b-256 ca4b88127b07b80c5fa423c82bee382d5c13344e7cdac2b61a76f2b2cddb6a7a

See more details on using hashes here.

Supported by

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