Skip to content
Snippets Groups Projects
Commit 71d9276d authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[doc] Simplifying logging example (remove doctest)

parent 309ba0f2
No related branches found
No related tags found
No related merge requests found
Pipeline #64723 passed
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment