Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Python-announce] structlog 23.1.0

9 views
Skip to first unread message

Hynek Schlawack

unread,
Apr 6, 2023, 9:02:18 AM4/6/23
to
I’m happy to announce a new release of structlog!

With more than 7 million downloads per month, structlog is the best solution for production-ready structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out <https://www.structlog.org/en/stable/why.html> if you’re intrigued but not convinced!

My heartfelt thanks go to my generous GitHub sponsors <https://github.com/sponsors/hynek> and companies subscribing to structlog on Tidelift <https://tidelift.com/subscription/pkg/pypi-structlog>.

That's the support that made me maintain structlog for almost a decade with no end in sight! <3

------------------------------------------------------------------------

(alternatively, see <https://github.com/hynek/structlog/releases/> for a richer-formatted version of the following)


Highlights

This release brings the hybrid approach to sync / async logging to structlog's standard library integration. You don't have to configure anything anymore, simply prepend the method name with an a and await it: await logger.ainfo("this is async!"). structlog.stdlib.AsyncBoundLogger will probably be deprecated in the future.

This release also brings support for FORCE_COLOR and NO_COLOR to structlog's default configuration. structlog was originally not meant to be used without configuration, but times have changed and we're breaking new ground!

Added

- structlog.stdlib.BoundLogger now has, analogously to our native logger, a full set of async log methods prefixed with an a: await log.ainfo("event!") #502

- The default configuration now respects the presence of FORCE_COLOR (regardless of its value, unless an empty string). This disables all heuristics whether it makes sense to use colors. #503

- The default configuration now respects the presence of NO_COLOR (regardless of its value, unless an empty string). This disables all heuristics whether it makes sense to use colors and overrides FORCE_COLOR. #504

Fixed

- ConsoleRenderer now reuses the _figure_out_exc_info to process the exc_info argument like ExceptionRenderer does. This prevents crashes if the actual Exception is passed for the exc_info argument instead of a tuple or True. #482

- FilteringBoundLogger.aexception() now extracts the exception info using sys.exc_info() before passing control to the asyncio executor (where original exception info is no longer available). #488

0 new messages