mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-13 09:32:27 +03:00
Show how to set another level for the library
parent
a6e1e53c39
commit
b71c25fde8
|
@ -5,7 +5,9 @@ import logging
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use it in your own project very easily:
|
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
|
```python
|
||||||
import logging
|
import logging
|
||||||
|
@ -15,3 +17,11 @@ logger.debug('Debug messages')
|
||||||
logger.info('Useful information')
|
logger.info('Useful information')
|
||||||
logger.warning('This is a warning!')
|
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)
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user