Destroyed Enabling logging (markdown)

Lonami 2018-06-25 09:26:08 +02:00
parent 5d913c743b
commit 0a8a6a2817

@ -1,27 +0,0 @@
Telethon makes use of the [`logging`](https://docs.python.org/3/library/logging.html) module, and you can enable it as follows:
```python
import logging
logging.basicConfig(level=logging.DEBUG)
```
The library has the [`NullHandler`](https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library) added by default so that no log calls will be printed unless you explicitly enable it.
You can also [use the module](https://docs.python.org/3/howto/logging.html) on your own project very easily:
```python
import logging
logger = logging.getLogger(__name__)
logger.debug('Debug messages')
logger.info('Useful information')
logger.warning('This is a warning!')
```
If you want to enable `logging` for your project *but* use a different log level for the library:
```python
import logging
logging.basicConfig(level=logging.DEBUG)
# For instance, show only warnings and above
logging.getLogger('telethon').setLevel(level=logging.WARNING)
```