Skip to main content

structlog-pretty

CI Status Code Coverage

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.PathPrettifier(),
    structlog_pretty.SyntaxHighlighter({'request': 'json', 'response': 'json', 'soap_response': 'xml'}),
    structlog_pretty.MultilinePrinter(['request', 'response', 'soap_response']),
    # ...
],

Metadata

Release files for structlog-pretty 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structlog-pretty 0.4.3
File Size Uploaded Provenance Actions
structlog_pretty-0.4.3.tar.gz 7.4 kB Without provenance Details for structlog_pretty-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for structlog-pretty 0.4.3
File Interpreter ABI Platform Actions
structlog_pretty-0.4.3-py3-none-any.whl Python 3 none any Details for structlog_pretty-0.4.3-py3-none-any.whl

Total release size: 13.1 kB

Release files / structlog_pretty-0.4.3.tar.gz

Download URL structlog_pretty-0.4.3.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e5c6a8e98cdacd517a469dbedfe70de33eff5f2537343933024d6e2c0da8711d
BLAKE2b-256 checksum
How to use checksums
9e4cfaf8822fa7af8cfe3f7d93bba98db57e1e63be3c87378e7599668436602b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Release files / structlog_pretty-0.4.3-py3-none-any.whl

Download URL structlog_pretty-0.4.3-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
352a2e0a1c59b95ef37da9da6caa7e3b25c34a8d7793fcc910c277eb7584d2bb
BLAKE2b-256 checksum
How to use checksums
2a57d6c3d2b337d3cc35359d072ce821d3991fee0d256ad2b1bd4b9e386cc099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Security for structlog-pretty 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page