Skip to content

Add ASGI scope access-log atoms - #379

Open
Gonghan-Princess wants to merge 1 commit into
pgjones:mainfrom
Gonghan-Princess:codex/access-log-scope
Open

Gonghan-Princess wants to merge 1 commit into
pgjones:mainfrom
Gonghan-Princess:codex/access-log-scope

Conversation

@Gonghan-Princess

Copy link
Copy Markdown

Summary

Add a non-breaking {Variable}s access-log atom for string and byte values in the request's ASGI scope, as requested in #359. This makes request-specific trace IDs loggable without storing them in process-wide environment variables. The existing {Variable}e atom remains unchanged.

Scope byte values use Latin-1, consistent with the existing header atoms. Missing keys and unsupported value types render as -. Documentation and a regression test cover formatting, bytes, unsupported values, and coexistence with environment atoms.

Verification

  • pytest tests -q with seven known Windows/incompatible cases deselected: 190 passed, 7 deselected. Without deselection, the six failures are identical on the pristine base checkout (186 passed there, 187 passed with this change); the seventh case uses Unix /tmp/path for a file handler.
  • Focused logging tests: 11 passed, 4 deselected.
  • Black, isort, flake8, git diff --check: pass.
  • Mypy on changed Python files with --no-warn-unused-ignores: pass. Unmodified base already has obsolete type: ignore and Windows-only socket typing errors with the installed mypy version.
  • Sphinx documentation build with -W --keep-going after sphinx-apidoc: pass.
  • Source distribution and wheel build: pass.

This contribution was prepared with AI assistance and verified against the pristine base checkout.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant