1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
Metadata-Version: 2.4
Name: structlog
Version: 25.5.0
Summary: Structured Logging for Python
Project-URL: Documentation, https://www.structlog.org/
Project-URL: Changelog, https://github.com/hynek/structlog/blob/main/CHANGELOG.md
Project-URL: GitHub, https://github.com/hynek/structlog
Project-URL: Funding, https://github.com/sponsors/hynek
Project-URL: Tidelift, https://tidelift.com?utm_source=lifter&utm_medium=referral&utm_campaign=hynek
Project-URL: Mastodon, https://mastodon.social/@hynek
Project-URL: Bluesky, https://bsky.app/profile/hynek.me
Project-URL: Twitter, https://twitter.com/hynek
Author-email: Hynek Schlawack <hs@ox.cx>
License-Expression: MIT OR Apache-2.0
License-File: LICENSE-APACHE
License-File: LICENSE-MIT
License-File: NOTICE
Keywords: log,logging,structure,structured
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Logging
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: typing-extensions; python_version < '3.11'
Description-Content-Type: text/markdown
<p align="center">
<img
src="https://www.structlog.org/en/stable/_static/structlog_logo_small.png"
alt="structlog mascot"
/>
</p>
*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*](https://brandur.org/logfmt), as well as pretty console output out-of-the-box:
[](https://github.com/hynek/structlog/blob/main/docs/_static/console_renderer.png?raw=true)
## Sponsors
*structlog* would not be possible without our [amazing sponsors](https://github.com/sponsors/hynek).
Especially those generously supporting us at the *The Organization* tier and higher:
<!-- pause-short -->
<p align="center">
<!-- [[[cog
import pathlib, tomllib
for sponsor in tomllib.loads(pathlib.Path("pyproject.toml").read_text())["tool"]["sponcon"]["sponsors"]:
print(f'<a href="{sponsor["url"]}"><img title="{sponsor["title"]}" src="https://www.structlog.org/en/25.5.0/_static/sponsors/{sponsor["img"]}" width="190" /></a>')
]]] -->
<a href="https://www.variomedia.de/"><img title="Variomedia AG" src="https://www.structlog.org/en/25.5.0/_static/sponsors/Variomedia.svg" width="190" /></a>
<a href="https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"><img title="Tidelift" src="https://www.structlog.org/en/25.5.0/_static/sponsors/Tidelift.svg" width="190" /></a>
<a href="https://privacy-solutions.org/"><img title="Privacy Solutions" src="https://www.structlog.org/en/25.5.0/_static/sponsors/Privacy-Solutions.svg" width="190" /></a>
<a href="https://filepreviews.io/"><img title="FilePreviews" src="https://www.structlog.org/en/25.5.0/_static/sponsors/FilePreviews.svg" width="190" /></a>
<a href="https://polar.sh/"><img title="Polar" src="https://www.structlog.org/en/25.5.0/_static/sponsors/Polar.svg" width="190" /></a>
<!-- [[[end]]] -->
</p>
<!-- continue-short -->
<p align="center">
<strong>Please consider <a href="https://github.com/sponsors/hynek">joining them</a> to help make <em>structlog</em>’s maintenance more sustainable!</strong>
</p>
## Introduction
*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](https://twitter.com/sirupsen/status/638330548361019392) structured logging [packages across ecosystems](https://github.com/sirupsen/logrus).
## Project Links
- [**Get Help**](https://stackoverflow.com/questions/tagged/structlog) (use the *structlog* tag on Stack Overflow)
- [**PyPI**](https://pypi.org/project/structlog/)
- [**GitHub**](https://github.com/hynek/structlog)
- [**Documentation**](https://www.structlog.org/)
- [**Changelog**](https://github.com/hynek/structlog/tree/main/CHANGELOG.md)
- [**Third-party Extensions**](https://github.com/hynek/structlog/wiki/Third-party-Extensions)
## *structlog* for Enterprise
Available as part of the [Tidelift Subscription](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek).
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.
## Release Information
### Deprecated
- `structlog.dev.ConsoleRenderer()`'s *pad_event* argument has been renamed to *pad_event_to* to differentiate it from the boolean *pad_level* argument.
*pad_event* is now deprecated.
### Added
- Added `structlog.dev.ConsoleRenderer.get_active()` that returns the currently active `structlog.dev.ConsoleRenderer()`.
[#749](https://github.com/hynek/structlog/pull/749)
- `structlog.dev.ConsoleRenderer()` now supports setting the `exception_formatter` attribute.
You can now disable the pretty-printing of exceptions by setting it to `structlog.dev.plain_traceback`:
```python
cr = structlog.dev.ConsoleRenderer.get_active()
cr.exception_formatter = structlog.dev.plain_traceback
```
Same goes for *sort_keys*, *columns*, *colors*, *force_colors*, *level_styles*, *pad_event_to*, *event_key*, *timestamp_key*, and *repr_native_str*.
[#749](https://github.com/hynek/structlog/pull/749)
[#756](https://github.com/hynek/structlog/pull/756)
[#757](https://github.com/hynek/structlog/pull/757)
[#759](https://github.com/hynek/structlog/pull/759)
- Added `structlog.dev.ConsoleRenderer.get_default_column_styles()` for reuse the default column styles.
[#741](https://github.com/hynek/structlog/pull/741)
- `structlog.testing.capture_logs()` now optionally accepts *processors* to apply before capture.
[#728](https://github.com/hynek/structlog/pull/728)
- `structlog.dev.RichTracebackFormatter` now exposes the upstream *code_width* parameter.
Default *width* is now `None` for full terminal width.
Full terminal width is now handled by Rich itself, bringing support for reflow and `COLUMN` environment variable.
Passing `-1` for *width* is now deprecated and automatically replaced by `None`.
[#717](https://github.com/hynek/structlog/pull/717)
- Native loggers now allow the passing of a dictionary for dictionary-based interpolation `log.info("hello %(name)s!", {"name": "world"})`.
[#748](https://github.com/hynek/structlog/pull/748)
- On Python 3.11+, `structlog.processors.CallsiteParameterAdder` now supports `CallsiteParameter.QUAL_NAME` that adds the qualified name of the callsite, including scope and class names.
This is only available for *structlog*-originated events since the standard library has no equivalent.
- `structlog.stdlib.LoggerFactory` now supports the *stacklevel* parameter.
[#763](https://github.com/hynek/structlog/pull/763)
### Changed
- `structlog.dev.rich_traceback()` now throws a more helpful error when Rich is missing.
[#735](https://github.com/hynek/structlog/pull/735)
### Fixed
- `structlog.processors.MaybeTimeStamper` now respects the *key* argument when determining whether to overwrite the timestamp field.
[#747](https://github.com/hynek/structlog/pull/747)
- `structlog.tracebacks.extract()` no longer raises a `RecursionError` when the cause chain of an exception contains itself.
[#739](https://github.com/hynek/structlog/pull/739)
- Default config now respects `FORCE_COLOR` on Windows.
[#758](https://github.com/hynek/structlog/pull/758)
---
[Full Changelog →](https://www.structlog.org/en/stable/changelog.html)
## Credits
*structlog* is written and maintained by [Hynek Schlawack](https://hynek.me/).
The idea of bound loggers is inspired by previous work by [Jean-Paul Calderone](https://github.com/exarkun) and [David Reid](https://github.com/dreid).
The development is kindly supported by my employer [Variomedia AG](https://www.variomedia.de/), *structlog*’s [Tidelift subscribers](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek), and all my amazing [GitHub Sponsors](https://github.com/sponsors/hynek).
The logs-loving beaver logo has been contributed by [Lynn Root](https://www.roguelynn.com).
|