mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 08:37:07 +01:00
Update tests and logging
This commit is contained in:
parent
66aaaf9ec0
commit
09ffd28df5
3 changed files with 22 additions and 8 deletions
18
README.rst
18
README.rst
|
@ -32,7 +32,9 @@ Table of contents
|
|||
|
||||
1. `API`_
|
||||
|
||||
2. `Examples`_
|
||||
2. `Logging`_
|
||||
|
||||
3. `Examples`_
|
||||
|
||||
- `Contact`_
|
||||
|
||||
|
@ -191,9 +193,19 @@ There are many more API methods, to read the full API documentation::
|
|||
|
||||
$ pydoc telegram.Bot
|
||||
|
||||
To get a verbose mode to debug::
|
||||
-----------
|
||||
_`Logging`
|
||||
-----------
|
||||
|
||||
>>> telegram.Bot('token', debug=True)
|
||||
You can get logs in your main application by calling `logging` and setting the log level you want::
|
||||
|
||||
>>> import logging
|
||||
>>> logger = logging.getLogger()
|
||||
>>> logger.setLevel(logging.INFO)
|
||||
|
||||
If you want DEBUG logs instead::
|
||||
|
||||
>>> logger.setLevel(logging.DEBUG)
|
||||
|
||||
-----------
|
||||
_`Examples`
|
||||
|
|
|
@ -5,5 +5,7 @@ from tests.test_bot import BotTest
|
|||
if __name__ == '__main__':
|
||||
logging.basicConfig(
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
testsuite = unittest.TestLoader().loadTestsFromTestCase(BotTest)
|
||||
unittest.TextTestRunner(verbosity=1).run(testsuite)
|
||||
|
|
|
@ -7,7 +7,7 @@ import unittest
|
|||
|
||||
class BotTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
bot = telegram.Bot(token=os.environ.get('TOKEN'), debug=True)
|
||||
bot = telegram.Bot(token=os.environ.get('TOKEN'))
|
||||
self._bot = bot
|
||||
print('Testing the Bot API class')
|
||||
|
||||
|
|
Loading…
Reference in a new issue