chore(deps): bump structlog from 20.2.0 to 22.1.0
Bumps structlog from 20.2.0 to 22.1.0.
Release notes
Sourced from structlog's releases.
22.1.0
Highlights
This is a (too) big release, so it has many highlights!
Firstly, rendering exceptions in machine-readable logs (usually JSON) got a big upgrade: thanks to
structlog.processors.dict_tracebacksyou can now have fully structured exceptions in your logs!To ease getting started with
structlog, we're now shippingstructlog.stdlib.recreate_defaults()that recreatesstructlog's default behavior, but on top of standard library'slogging. The output looks the same, but it runs throughlogging's machinery and integrates itself easier. The default configuration now also merges yourcontextvars-based context, so enjoystructlog.contextvars.bind_contextvars()without configuring anything!Another request wish that kept coming up is naming the message key differently than
event. We're aware that nowadays keys likemsgare more common, butstructlogpre-dates the software that introduced and popularized it. To allow for more consistency across your platforms,structlognow shipsstructlog.processors.EventRenamerthat allows you to rename the defaulteventkey to something else and additionally also allows you to rename another key toevent.❤️ Huge thanks to my GitHub sponsors, Tidelift subscribers, and Ko-fi buyers! ❤️
None of my projects would exist in their current form without you!
Full Changelog
Removed
- Python 3.6 is not supported anymore.
- Pickling is now only possible with protocol version 3 and newer.
Deprecated
The entire
structlog.threadlocalmodule is deprecated. Please use the primitives fromstructlog.contextvarsinstead.If you're using the modern APIs (
bind_threadlocal()/merge_threadlocal()) it's enough to replace them 1:1 with theircontextvarscounterparts. The old approach aroundwrap_dict()has been discouraged for a while.Currently there are no concrete plans to remove the module, but no patches against it will be accepted from now on. #409
Added
structlog.processors.StackInfoRenderernow has an additional_ignores parameter that allows you to filter out your own logging layer. #396- Added
structlog.WriteLogger, a faster – but more low-level – alternative tostructlog.PrintLogger. It works the wayPrintLoggerused to work in previous versions. #403 #404structlog.make_filtering_bound_logger()-returned loggers now also have alog()method to match thestructlog.stdlib.BoundLoggersignature closer. #413- Added structured logging of tracebacks via the
structlog.tracebacksmodule, and most notably thestructlog.tracebacks.ExceptionDictTransformerwhich can be used with the newstructlog.processors.ExceptionRendererto render JSON tracebacks. #407structlog.stdlib.recreate_defaults(log_level=logging.NOTSET)that recreatesstructlog's defaults on top of standard library'slogging. It optionally also configuresloggingto log to standard out at the passed log level. #428structlog.processors.EventRenamerallows you to rename the hitherto hard-coded event dict keyeventto something else. Optionally, you can rename another key toeventat the same time, too. So addingEventRenamer(to="msg", replace_by="_event")to your processor pipeline will rename the standardeventkey tomsgand then rename the_eventkey toevent. This allows you to use theeventkey in your own log files and to have consistent log message keys across languages.structlog.dev.ConsoleRenderer(event_key="event")now allows to customize the name of the key that is used for the log message.Changed
structlog.make_filtering_bound_logger()now returns a method with the same signature for all log levels, whether they are active or not. This ensures that invalid calls to inactive log levels are caught immediately and don't explode once the log level changes. #401structlog.PrintLogger– that is used by default – now usesprint()for printing, making it a better citizen for interactive terminal applications. #399structlog.testing.capture_logsnow works for already initialized bound loggers. #408structlog.processors.format_exc_info()is no longer a function, but an instance ofstructlog.processors.ExceptionRenderer. Its behavior has not changed. #407- The default configuration now includes the
structlog.contextvars.merge_contextvarsprocessor. That means you can usestructlog.contextvarsfeatures without configuringstructlog.Fixed
... (truncated)
Changelog
Sourced from structlog's changelog.
22.1.0 - 2022-07-20
Removed
- Python 3.6 is not supported anymore.
- Pickling is now only possible with protocol version 3 and newer.
Deprecated
The entire
structlog.threadlocalmodule is deprecated. Please use the primitives fromstructlog.contextvarsinstead.If you're using the modern APIs (
bind_threadlocal()/merge_threadlocal()) it's enough to replace them 1:1 with theircontextvarscounterparts. The old approach aroundwrap_dict()has been discouraged for a while.Currently there are no concrete plans to remove the module, but no patches against it will be accepted from now on. #409
Added
structlog.processors.StackInfoRenderernow has an additional_ignores parameter that allows you to filter out your own logging layer. #396- Added
structlog.WriteLogger, a faster – but more low-level – alternative tostructlog.PrintLogger. It works the wayPrintLoggerused to work in previous versions. #403 #404structlog.make_filtering_bound_logger()-returned loggers now also have alog()method to match thestructlog.stdlib.BoundLoggersignature closer. #413- Added structured logging of tracebacks via the
structlog.tracebacksmodule, and most notably thestructlog.tracebacks.ExceptionDictTransformerwhich can be used with the newstructlog.processors.ExceptionRendererto render JSON tracebacks. #407structlog.stdlib.recreate_defaults(log_level=logging.NOTSET)that recreatesstructlog's defaults on top of standard library'slogging. It optionally also configuresloggingto log to standard out at the passed log level. #428structlog.processors.EventRenamerallows you to rename the hitherto hard-coded event dict keyeventto something else. Optionally, you can rename another key toeventat the same time, too. So addingEventRenamer(to="msg", replace_by="_event")to your processor pipeline will rename the standardeventkey tomsgand then rename the_eventkey toevent. This allows you to use theeventkey in your own log files and to have consistent log message keys across languages.structlog.dev.ConsoleRenderer(event_key="event")now allows to customize the name of the key that is used for the log message.Changed
structlog.make_filtering_bound_logger()now returns a method with the same signature for all log levels, whether they are active or not. This ensures that invalid calls to inactive log levels are caught immediately and don't explode once the log level changes. #401structlog.PrintLogger– that is used by default – now usesprint()for printing, making it a better citizen for interactive terminal applications. #399
... (truncated)
Commits
0ca06b7Prepare 22.1.0425b7e1Ignore compare links (they may not exist yet)646e9fcAdd NOTICE to sdist6b30f49Fix broken links63e1dcdSteal Rust's dual-license handling again9b2458bClarify licensing/contribution of trackbacks.py6fb6e7aAdd annotations future import to src/* for consistency414475dAdd structlog.contextvars.merge_contextvars to default configd366240Fix grammar & clarity70deda6Clarify license in docs, cleanup index- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
-
@dependabot rebasewill rebase this PR -
@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it -
@dependabot mergewill merge this PR after your CI passes on it -
@dependabot squash and mergewill squash and merge this PR after your CI passes on it -
@dependabot cancel mergewill cancel a previously requested merge and block automerging -
@dependabot reopenwill reopen this PR if it is closed -
@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually -
@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Codecov Report
Merging #249 (171bd3c) into master (8ae8cf9) will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## master #249 +/- ##
=======================================
Coverage 94.60% 94.60%
=======================================
Files 93 93
Lines 2948 2948
Branches 273 273
=======================================
Hits 2789 2789
Misses 135 135
Partials 24 24
Superseded by #267.