1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Update logger readme.

This commit is contained in:
eternnoir 2015-07-20 10:38:33 +08:00
parent 99b82b6219
commit 43e1d26696

View File

@ -237,6 +237,21 @@ while True: # Don't end the main thread.
```
Use whichever mechanism fits your purpose! It is even possible to mix and match.
## Logging
Now you can use Telebot module logger to log some information in Telebot. Use `telebot.logger` to get
Telebot module logger.
```python
logger = telebot.logger
formatter = logging.Formatter('[%(asctime)s] %(thread)d {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s',
'%m-%d %H:%M:%S')
ch = logging.StreamHandler(sys.stdout)
logger.addHandler(ch)
logger.setLevel(logging.DEBUG) # or use logging.INFO
ch.setFormatter(formatter)
```
## Telegram Chat Group
Get help. Discuss. Chat.