1Development 2=========== 3 4To make development a more pleasurable experience, ``structlog`` comes with the :mod:`structlog.dev` module. 5 6The highlight is :class:`structlog.dev.ConsoleRenderer` that offers nicely aligned and colorful console output while in development: 7 8.. figure:: _static/console_renderer.png 9 :alt: Colorful console output by ConsoleRenderer. 10 11To use it, just add it as a renderer to your processor chain. 12It will recognize logger names, log levels, time stamps, stack infos, and tracebacks as produced by ``structlog``'s processors and render them in special ways. 13 14``structlog``'s default configuration already uses it, but if you want to use it along with standard library logging, we suggest the following configuration: 15 16.. code-block:: python 17 18 import structlog 19 20 structlog.configure( 21 processors=[ 22 structlog.stdlib.add_logger_name, 23 structlog.stdlib.add_log_level, 24 structlog.stdlib.PositionalArgumentsFormatter(), 25 structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M.%S"), 26 structlog.processors.StackInfoRenderer(), 27 structlog.processors.format_exc_info, 28 structlog.dev.ConsoleRenderer() # <=== 29 ], 30 context_class=dict, 31 logger_factory=structlog.stdlib.LoggerFactory(), 32 wrapper_class=structlog.stdlib.BoundLogger, 33 cache_logger_on_first_use=True, 34 ) 35