Skip to content

Keep Named*Logger.name working across structlog releases#66875

Open
ashb wants to merge 1 commit into
mainfrom
structlog-bytes-logger-compat
Open

Keep Named*Logger.name working across structlog releases#66875
ashb wants to merge 1 commit into
mainfrom
structlog-bytes-logger-compat

Conversation

@ashb
Copy link
Copy Markdown
Member

@ashb ashb commented May 13, 2026

Pre-emptive change to support - structlog 26.1.0 (most likely version - merged in hynek/structlog#786) adds a name slot and a kwarg-only
name argument to BytesLogger, and its __init__ now assigns
self.name = name.

In NamedBytesLogger we were setting self.name before calling
super().__init__, so on the new release the parent would overwrite the
caller-supplied name with None, breaking the per-logger level lookup in
make_filtering_logger and any other consumer that reads logger.name.

Since this is ont yet released, I can't be certain if it will be in 26.1.0 or
something else, but it's merged to structlog's main, so lets cope with it
when ever it lands


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@ashb ashb requested review from amoghrajesh and potiuk as code owners May 13, 2026 15:22
@ashb ashb added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label May 13, 2026
@ashb ashb added this to the Airflow 3.2.2 milestone May 13, 2026
A pre-emptive change to support - structlog 26.1.0 (most likely version -
merged in hynek/structlog#786) adds a `name` slot and a kwarg-only `name`
argument to `BytesLogger`, and its `__init__` now assigns `self.name = name`.

In NamedBytesLogger we were setting `self.name` *before* calling
`super().__init__`, so on the new release the parent would overwrite the
caller-supplied name with `None`, breaking the per-logger level lookup in
`make_filtering_logger` and any other consumer that reads `logger.name`.

Since this is not yet released, I can't be certain if it will be in 26.1.0 or
something else, but it's merged to structlog's main, so lets cope with it when
ever it lands.
@ashb ashb force-pushed the structlog-bytes-logger-compat branch from 7f44bc2 to ffade0c Compare May 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants