A collection of structlog processors for prettier output
Project description
A collection of structlog processors for prettier output: a code syntax highlighter, JSON and XML prettifiers, a multiline string printer, and a numeric value rounder.
Installation
First of all, sorry, grandma, but structlog-pretty requires Python 3.
You can just install the library with pip:
pip install structlog-pretty
or, if you want faster prettifying processors:
pip install structlog-pretty[fast]
The downside of the faster processors is that they will build C extensions and they need libxml to be installed.
Usage
Add structlog-pretty processors to your structlog configuration
import structlog
import structlog_pretty
structlog.configure(
# ...
processors=[
structlog.stdlib.add_log_level,
structlog_pretty.NumericRounder(digits=2, only_fields=['timing'])
structlog.processors.JSONRenderer(),
],
)
A nice example of a processor pipeline for the prettiest logs could be
processors=[
# ...
structlog_pretty.JSONPrettifier(['request', 'response']),
structlog_pretty.XMLPrettifier(['soap_response']),
structlog_pretty.SyntaxHighlighter({'request': 'json', 'response': 'json', 'soap_response': 'xml'}),
structlog_pretty.MultilinePrinter(['request', 'response', 'soap_response']),
# ...
],
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for structlog-pretty-0.1.0.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11c49699dc96d6bb30c680f7ad98d0d7d6d3c548370359bf14594e9d3813c41 |
|
MD5 | a80916070097c47728a94463a5ae495b |
|
BLAKE2b-256 | b714d057295cb8e4a39cf2c5738fa4e15d40dd4ed5d965783612f0156fb2ad89 |
Close
Hashes for structlog_pretty-0.1.0.post1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe8531928d2338e377bdf7083ec78f4510965d03d111f73250bb559e7699266 |
|
MD5 | bbc0bc24bddc774d4c7a026cd7b6559a |
|
BLAKE2b-256 | 40972cd20492d0b11f66d91608f0358a94cf712f7fd40ae6f077ed0e5ba6b409 |