diff --git a/Enabling-logging.md b/Enabling-logging.md index abe8fbd..0ffdb1e 100644 --- a/Enabling-logging.md +++ b/Enabling-logging.md @@ -5,7 +5,9 @@ import logging 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 import logging @@ -15,3 +17,11 @@ 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) +``` \ No newline at end of file