1
0
mirror of https://github.com/otter18/tg_logger.git synced 2025-06-12 21:47:26 +02:00

v2.0.1 realise

This commit is contained in:
Chernykh Vladimir
2021-02-03 20:18:57 +03:00
parent 34e7761bcf
commit f72e3d6ba2
4 changed files with 57 additions and 50 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
__pycache__/
*.pyc
dist/
*.egg-info/
.coverage

View File

@ -1,4 +1,6 @@
# ![tg_logo](img/telegram-icon.png)tg_logger tool
# ![tg_logo](https://i.ibb.co/ftBZY9z/telegram-icon.png) tg_logger tool
[![](https://img.shields.io/pypi/v/tg-logger.svg)](https://pypi.org/project/tg-logger/)
bridging python logging and user files to tg bot
## Example
@ -7,7 +9,7 @@ bridging python logging and user files to tg bot
import logging
from tg_logger import __init__
import tg_logger
# Telegram data
token = "1234567890:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
@ -18,7 +20,7 @@ logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s - %(message)s')
formatter = logging.Formatter('<b>%(name)s:%(levelname)s</b> - <code>%(message)s</code>')
# Setup TgLoggerHandler
tg_handler = __init__.TgLoggerHandler(
tg_handler = tg_logger.TgLoggerHandler(
token=token, # tg bot token
users=users, # list of user_id
timeout=10 # default value is 10 seconds
@ -32,7 +34,7 @@ logger.addHandler(tg_handler)
logger.info("Hello from tg_logger by otter18")
# TgFileLogger example
tg_files_logger = __init__.TgFileLogger(
tg_files_logger = tg_logger.TgFileLogger(
token=token, # tg bot token
users=users, # list of user_id
timeout=10 # default is 10 seconds
@ -49,4 +51,4 @@ logger.info("Finishing tg_logger demo")
```
## Result
![example_scr](img/example_scr.jpg)
![example_scr](https://i.ibb.co/ByDrZv3/example-scr.jpg)

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="tg_logger",
version="1.1",
version="2.0.1",
description="A tool to bridge python logging and user files to telegram bot",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
@ -11,6 +11,6 @@ setup(
url="https://github.com/otter18/tg_logger",
packages=find_packages(),
install_requires=[
"pytelegrambotapi==3.7.6",
"pyTelegramBotAPI==3.7.6",
]
)