Log errors in a log.txt file and receive them by telegram.
Project description
Useful functions to log efficiently into a log.txt file and send you logs by Telegram.
Using this logger will :
- Create a
log.txtfile and append it new errors, with date and time of happening ; - Send you every info or error via Telegram.
To install, type python3 -m pip install tglog, or try with py instead of python3 if you get any error.
You need your telegram chat_id, usually a chain of integers and the token of the telegram bot you want to receive logs from.
If you don't know your telegram chat_id, just send /my_id to telegram bot @get_id_bot.
If you haven't created any telegram bot, just send /newbot to @BotFather.
How to use :
Initialization :
import tglog
my_chat_id = "12345" # Your telegram chat_id
my_bot_token = "token123" # The token of the telegram bot you want to receive logs from
# Initialize your logger :
tl = tglog.logger(my_chat_id, my_bot_token)
Use any of those functions in your code :
Useful for debugging ; Telegram bot won't send notification :
Receive message when checkpoint reached :
tl.debug("info for debugging")
Useful for logging some infos
Receive some infos :
tl.info("info to be logged")
Useful for logging errors
Receive traceback of errors :
tl.error(traceback.format_exc())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tglog-1.0.1.tar.gz.
File metadata
- Download URL: tglog-1.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f22f25f1818a5fd835602794f3b427cbdfef1bb25d393b2d249c188631d9293
|
|
| MD5 |
1b239e0aeb5c63c36058d7292ec5da52
|
|
| BLAKE2b-256 |
6e860fb7bf2074f1421503b4b1a53ac8cde45194f0c161ed06592cf7bf068a83
|
File details
Details for the file tglog-1.0.1-py3-none-any.whl.
File metadata
- Download URL: tglog-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0f0e0fd2dad310629aadfdf8d11a5793c693026eb2bae43e730cfaeae9a2d56
|
|
| MD5 |
2f793d35dc09ca4917acc5f5b1e0a2a5
|
|
| BLAKE2b-256 |
a60ab0ff4609c100284b81944a94018fde24bbbe04cc9f79b3f8e82910c7f157
|