2015-06-08 14:09:56 +00:00
|
|
|
Examples
|
|
|
|
========
|
|
|
|
|
|
|
|
Simple Usage
|
|
|
|
------------
|
2015-06-08 17:20:03 +00:00
|
|
|
The following snippet uses :class:`sprockets.logging.ContextFilter`
|
2015-06-08 14:09:56 +00:00
|
|
|
to insert context information into a message using a
|
|
|
|
:class:`logging.LoggerAdapter` instance.
|
|
|
|
|
2015-06-08 17:20:03 +00:00
|
|
|
.. literalinclude:: ../examples/simple.py
|
2015-06-08 14:09:56 +00:00
|
|
|
|
2015-06-08 17:20:03 +00:00
|
|
|
Dictionary-based Configuration
|
|
|
|
------------------------------
|
|
|
|
This package begins to shine if you use the dictionary-based logging
|
|
|
|
configuration offered by :func:`logging.config.dictConfig`. You can insert
|
|
|
|
the custom filter and format string into the logging infrastructure and
|
|
|
|
insert context easily with :class:`logging.LoggerAdapter`.
|
2015-06-08 14:09:56 +00:00
|
|
|
|
2015-06-08 17:20:03 +00:00
|
|
|
.. literalinclude:: ../examples/tornado-app.py
|