Change8

26.1.0

📦 structlogView on GitHub →
5 features🐛 3 fixes1 deprecations🔧 10 symbols

Summary

This substantial release removes support for Python 3.8/3.9, adds Python 3.15 support, and introduces several new features including Rich monochrome traceback rendering and enhanced logger compatibility.

Migration Steps

  1. If you rely on `better-exceptions`, migrate to using the Rich integration or manually implement the necessary traceback rendering logic.
  2. If using `structlog.stdlib.BoundLogger` and relying on snake_case methods for compatibility with `FilteringBoundLogger`, note that `is_enabled_for()` and `get_effective_level()` are now available.

✨ New Features

  • Added Python 3.15 support.
  • Introduced `structlog.dev.rich_monochrome_traceback` for Rich-based monochrome exception rendering, and added support for it in `structlog.dev.ConsoleRenderer` when no colors are requested.
  • `structlog.BytesLogger` now includes a `name` attribute, enabling its use with `structlog.stdlib.add_logger_name()` without requiring standard library integration.
  • `structlog.processors.CallsiteParameterAdder` now supports `CallsiteParameter.QUAL_MODULE` to add the qualified import name of the callsite module.
  • `structlog.stdlib.BoundLogger` gained `is_enabled_for()` and `get_effective_level()` methods as snake_case aliases for `isEnabledFor()` and `getEffectiveLevel()`, improving compatibility with `structlog.typing.FilteringBoundLogger`.

🐛 Bug Fixes

  • `structlog.BytesLogger`, `structlog.PrintLogger`, and `structlog.WriteLogger` now use weak references for output files, preventing file handle leakage in long-running processes.
  • `structlog.WriteLogger` is now usable after unpickling.
  • `structlog.processors.CallsiteParameterAdder` correctly reports the calling thread's ID and name for async log methods, rather than the thread from the executor pool.

Affected Symbols

⚡ Deprecations

  • Support for *better-exceptions* is deprecated and will be removed within a year. Users should switch to the Rich integration or manually copy the required code snippet from `structlog.dev.py`.