Skip to content

Commit 09ffd28

Browse files
committed
Update tests and logging
1 parent 66aaaf9 commit 09ffd28

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

README.rst

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Table of contents
2121
- `Status`_
2222

2323
1. `Telegram API support`_
24-
24+
2525
2. `Python Version support`_
2626

2727
- `Installing`_
@@ -32,7 +32,9 @@ Table of contents
3232

3333
1. `API`_
3434

35-
2. `Examples`_
35+
2. `Logging`_
36+
37+
3. `Examples`_
3638

3739
- `Contact`_
3840

@@ -90,7 +92,7 @@ _`Installing`
9092
You can install python-telegram-bot using::
9193

9294
$ pip install python-telegram-bot
93-
95+
9496
Or upgrade to the latest version::
9597

9698
$ pip install python-telegram-bot --upgrade
@@ -191,10 +193,20 @@ There are many more API methods, to read the full API documentation::
191193

192194
$ pydoc telegram.Bot
193195

194-
To get a verbose mode to debug::
195-
196-
>>> telegram.Bot('token', debug=True)
197-
196+
-----------
197+
_`Logging`
198+
-----------
199+
200+
You can get logs in your main application by calling `logging` and setting the log level you want::
201+
202+
>>> import logging
203+
>>> logger = logging.getLogger()
204+
>>> logger.setLevel(logging.INFO)
205+
206+
If you want DEBUG logs instead::
207+
208+
>>> logger.setLevel(logging.DEBUG)
209+
198210
-----------
199211
_`Examples`
200212
-----------

telegram_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
if __name__ == '__main__':
66
logging.basicConfig(
77
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
8+
logger = logging.getLogger()
9+
logger.setLevel(logging.DEBUG)
810
testsuite = unittest.TestLoader().loadTestsFromTestCase(BotTest)
911
unittest.TextTestRunner(verbosity=1).run(testsuite)

tests/test_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class BotTest(unittest.TestCase):
99
def setUp(self):
10-
bot = telegram.Bot(token=os.environ.get('TOKEN'), debug=True)
10+
bot = telegram.Bot(token=os.environ.get('TOKEN'))
1111
self._bot = bot
1212
print('Testing the Bot API class')
1313

0 commit comments

Comments
 (0)