Structured Logging for Python
Project description
structlog makes structured logging in Python easy by augmenting your existing logger. It allows you to split your log entries up into key/value pairs and build them incrementally without annoying boilerplate code.
>>> from structlog import get_logger
>>> log = get_logger()
>>> log.info("key_value_logging", out_of_the_box=True, effort=0)
out_of_the_box=True effort=0 event='key_value_logging'
>>> log = log.bind(user='anonymous', some_key=23)
>>> log = log.bind(user='hynek', another_key=42)
>>> log.info('user.logged_in', happy=True)
some_key=23 user='hynek' another_key=42 happy=True event='user.logged_in'
It’s dual-licensed under Apache License, version 2 and MIT, available from PyPI, the source code can be found on GitHub, the documentation at http://www.structlog.org/.
structlog targets Python 2.6, 2.7, 3.3 and newer, and PyPy.
If you need any help, visit us on #structlog on Freenode!
Release Information
16.0.0 (2016-01-28)
Changes:
structlog.processors.ExceptionPrettyPrinter and structlog.processors.format_exc_info now support passing of Exceptions on Python 3.
Clean up the context when exiting structlog.threadlocal.tmp_bind in case of exceptions. [64]
Be more more lenient about missing __name__s. [62]
Add structlog.dev.ConsoleRenderer that renders the event dictionary aligned and with colors.
Use six for compatibility.
Add structlog.processors.UnicodeDecoder that will decode all byte string values in an event dictionary to Unicode.
Add serializer parameter to structlog.processors.JSONRenderer which allows for using different (possibly faster) JSON encoders than the standard library.
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
File details
Details for the file structlog-16.0.0.tar.gz
.
File metadata
- Download URL: structlog-16.0.0.tar.gz
- Upload date:
- Size: 154.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba305858ee5dcd4518d79ee99907565bcd2ccd3f1cfba9679105078d13e566d0 |
|
MD5 | 59ac00a23b966c6d63ad85c26f454ea9 |
|
BLAKE2b-256 | 6e8e7be23d5ef287113264b93676ab67f895f28b5f795d91a9a45ba3f4daeeab |
File details
Details for the file structlog-16.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: structlog-16.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bed91b277972d3cf9090403e0cb3c84f2a38ae890357165892d60e1b0240be84 |
|
MD5 | e76718f24ad671b1255f1489ee230990 |
|
BLAKE2b-256 | 353c258e5d3fda2605feae1f384970b20fd3d94d9dd2df216791623438716168 |