Skip to main content

Structured Logging for Python

Project description

https://travis-ci.org/hynek/structlog.svg?branch=master https://codecov.io/github/hynek/structlog/coverage.svg?branch=master

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 with no additional dependencies for core functionality.

If you need any help, visit us on #structlog on Freenode!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
structlog-15.3.0-py2.py3-none-any.whl (26.7 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Sep 25, 2015
structlog-15.3.0.tar.gz (68.4 kB) Copy SHA256 hash SHA256 Source None Sep 25, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page