Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
clapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
software
clapper
Commits
71d9276d
Commit
71d9276d
authored
2 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[doc] Simplifying logging example (remove doctest)
parent
309ba0f2
No related branches found
No related tags found
No related merge requests found
Pipeline
#64723
passed
2 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/logging.rst
+7
-14
7 additions, 14 deletions
doc/logging.rst
with
7 additions
and
14 deletions
doc/logging.rst
+
7
−
14
View file @
71d9276d
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment