Clean up and complete RTD documentation

This commit is contained in:
Lonami Exo
2018-01-05 00:59:53 +01:00
parent 6cb5931e7a
commit cb45e8fca9
29 changed files with 1096 additions and 702 deletions

View File

@@ -1,15 +1,18 @@
================
Enable Logging
Enabling Logging
================
Telethon makes use of the `logging`__ module, and you can enable it as follows:
.. code-block:: python
.. code:: python
import logging
logging.basicConfig(level=logging.DEBUG)
import logging
logging.basicConfig(level=logging.DEBUG)
You can also use it in your own project very easily:
The library has the `NullHandler`__ added by default so that no log calls
will be printed unless you explicitly enable it.
You can also `use the module`__ on your own project very easily:
.. code-block:: python
@@ -21,4 +24,17 @@ You can also use it in your own project very easily:
logger.warning('This is a warning!')
__ https://docs.python.org/3/library/logging.html
If you want to enable ``logging`` for your project *but* use a different
log level for the library:
.. code-block:: python
import logging
logging.basicConfig(level=logging.DEBUG)
# For instance, show only warnings and above
logging.getLogger('telethon').setLevel(level=logging.WARNING)
__ https://docs.python.org/3/library/logging.html
__ https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
__ https://docs.python.org/3/howto/logging.html