diff --git a/doc/logging.rst b/doc/logging.rst index ecb11d0803602f3c019b59e620af0ccb7470004e..911a8ebfc3547e009cd26e2648ebddacf519320a 100644 --- a/doc/logging.rst +++ b/doc/logging.rst @@ -15,21 +15,14 @@ We provide a single a method in this library to help setup a particular documentation of :py:func:`expose.logging.setup` explains in details what it does. To use it in an application, follow this pattern: -.. doctest:: - :options: +NORMALIZE_WHITESPACE - - >>> import logging - >>> import io - >>> messages = io.StringIO() # captures stdout/stderr - >>> from expose.logging import setup - >>> logger = setup("mypackage", format="%(levelname)s: %(message)s", low_level_stream=messages, high_level_stream=messages) - >>> logger.setLevel(logging.INFO) # set log-level as you wish - >>> logger.info("test message") # use at application level, normally - >>> messages.seek(0) - 0 - >>> print(messages.read()) - INFO: test message +.. code-block:: python + import logging + from expose.logging import setup + logger = setup("mypackage", format="%(levelname)s: %(message)s") + logger.setLevel(logging.INFO) # set log-level as you wish + logger.info("test message") # use at application level, normally + INFO: test message To help with setting the base logger level via the CLI, we provide a