Metadata-Version: 2.1
Name: pytelelogger
Version: 0.1
Summary: Use Telegram bots to track your project logs in real-time.
Home-page: https://github.com/SN4KEBYTE/pytelelogger
Author: Timur Kasimov
License: GNU General Public License v3.0
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Description-Content-Type: text/markdown
Requires-Dist: python-telegram-bot (>=13.1)
Requires-Dist: pyyaml (>=5.3.1)

# pytelelogger
**pytelelogger** allows you to use Telegram bots to track your project logs in real-time.

# Installation
#### Dependencies
- python-telegram-bot>=13.1
- PyYAML>=5.3.1

#### User installation
The easiest way to install pytelelogger is ``pip``:\
``pip install pytelelogger``

# How to use
#### 1. Create Telegram bot
Check official Telegram documentation at ``https://core.telegram.org/bots`` and follow a few simple steps to create a bot. You will get an access token which is used to control your bot.
#### 2. Create cfg.yaml file
Example config file looks like this:
```yaml
# define bot access token, your Telegram username and your project name
token: YOUR_TOKEN
username: YOUR_USERNAME
project: "YOUR PROJECT NAME"

# set logging level
# DEBUG = 0
# INFO = 1
# WARNING = 3
# ERROR = 4
# CRITICAL = 5
level: 0

# set paths for duplicate files
# you can use one file to store everything (single), but using separate files (multi) is more convenient
mode: multi

# in case of single mode, debug key must store path to file
paths:
  debug: debug.txt
  info: info.txt
  warning: warning.txt
  error: error.txt
  critical: critical.txt

# customize key phrase
greeting: I'm ready!

# datetime format string that will be used in logging
dtf: "%d/%b/%Y %H:%M:%S"

# emojis to use in messages (debug, info, warning, error, critical)
emojis:
  debug: "⚙"
  info: "ℹ"
  warning: "⚠"
  error: "❌"
  critical: "🔴"
```
Later, ``chat_id`` field will be added to config file. Please, don't remove it.

#### 3. Add some code
```python
from pytelelogger import TeleLogger

if __name__ == '__main__':
    tl = TeleLogger('cfg.yaml')
    tl.debug('Debug message!')
    tl.info('Info message!')

    tl.stop(force=True)
```
You will get messages like this:\
![Example of received messages](https://raw.githubusercontent.com/SN4KEBYTE/pytelelogger/main/example_messages.png)\
And all logs are duplicated into files:
```text
[DEBUG:14/Jan/2021 03:48:32] Debug message!
```

```text
[INFO:14/Jan/2021 03:48:33] Info message!
```

# Development
#### Source code
The latest source code is available at:\
``https://github.com/SN4KEBYTE/pytelelogger``

#### Contributing
Feel free to open issues, send pull requests and review other users.

