diff --git a/README.rst b/README.rst index 55a34cf0b..afc17921a 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ Table of contents - `Status`_ 1. `Telegram API support`_ - + 2. `Python Version support`_ - `Installing`_ @@ -32,7 +32,9 @@ Table of contents 1. `API`_ - 2. `Examples`_ + 2. `Logging`_ + + 3. `Examples`_ - `Contact`_ @@ -90,7 +92,7 @@ _`Installing` You can install python-telegram-bot using:: $ pip install python-telegram-bot - + Or upgrade to the latest version:: $ pip install python-telegram-bot --upgrade @@ -191,10 +193,20 @@ There are many more API methods, to read the full API documentation:: $ pydoc telegram.Bot -To get a verbose mode to debug:: - - >>> telegram.Bot('token', debug=True) - +----------- +_`Logging` +----------- + +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` ----------- diff --git a/telegram_test.py b/telegram_test.py index fcb4307e8..2f82bcfa5 100644 --- a/telegram_test.py +++ b/telegram_test.py @@ -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) diff --git a/tests/test_bot.py b/tests/test_bot.py index d65a901f8..28339ab75 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -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')