Skip to main content

Structured Logging for Python

Project description

structlog mascot

structlog is the production-ready logging solution for Python:

  • Simple: Everything is about functions that take and return dictionaries – all hidden behind familiar APIs.
  • Powerful: Functions and dictionaries aren’t just simple but also powerful. structlog leaves you in control.
  • Fast: structlog is not hamstrung by designs of yore. Its flexibility comes not at the price of performance.

Thanks to its flexible design, you choose whether you want structlog to take care of the output of your log entries or whether you prefer to forward them to an existing logging system like the standard library's logging module.

The output format is just as flexible and structlog comes with support for JSON, logfmt, as well as pretty console output out-of-the-box:

image

Sponsors

structlog would not be possible without our amazing sponsors. Especially those generously supporting us at the The Organization tier and higher:

Please consider joining them to help make structlog’s maintenance more sustainable!


structlog has been successfully used in production at every scale since 2013, while embracing cutting-edge technologies like asyncio, context variables, or type hints as they emerged. Its paradigms proved influential enough to help design structured logging packages across ecosystems.

Project Links

structlog for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of structlog and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.

Release Information

Removed

  • Support for Python 3.7.

Added

  • Official support for Python 3.12. #515

  • structlog.processors.MaybeTimeStamper that only adds a timestamp if there isn't one already. #81

  • structlog.dev.ConsoleRenderer now supports renamed timestamp keys using the timestamp_key parameter. #541

  • structlog.dev.RichTracebackFormatter that allows to configure the traceback formatting. #542

Fixed

  • FilteringBoundLogger.exception() and FilteringBoundLogger.aexception() now support positional argument formatting like the rest of the methods. #531
  • structlog.processors.format_exc_info() and structlog.dev.ConsoleRenderer do not crash anymore when told to format a non-existent exception. #533

Full Changelog →

Credits

structlog is written and maintained by Hynek Schlawack. The idea of bound loggers is inspired by previous work by Jean-Paul Calderone and David Reid.

The development is kindly supported by my employer Variomedia AG, structlog’s Tidelift subscribers, and all my amazing GitHub Sponsors.

The logs-loving futuristic beaver logo has been contributed by Russell Keith-Magee.

Project details


Download files

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

Source Distribution

structlog-23.2.0.tar.gz (749.3 kB view details)

Uploaded Source

Built Distribution

structlog-23.2.0-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file structlog-23.2.0.tar.gz.

File metadata

  • Download URL: structlog-23.2.0.tar.gz
  • Upload date:
  • Size: 749.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for structlog-23.2.0.tar.gz
Algorithm Hash digest
SHA256 334666b94707f89dbc4c81a22a8ccd34449f0201d5b1ee097a030b577fa8c858
MD5 9e0fb06f6424c311f7c9dc6f7a258c9d
BLAKE2b-256 994c67e8cc235bbeb0a87053739c4c9d0619e3f284730ebdb2b34349488d9e8a

See more details on using hashes here.

File details

Details for the file structlog-23.2.0-py3-none-any.whl.

File metadata

  • Download URL: structlog-23.2.0-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for structlog-23.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16a167e87b9fa7fae9a972d5d12805ef90e04857a93eba479d4be3801a6a1482
MD5 37f11921b3a9eb04ee4ae36d3f7556f5
BLAKE2b-256 fc260f5f842dea4e93e28f7d4ed020021cf41ebd79572a06f12e273c8eac4db9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page