logging: silence tungstenite/tokio_tungstenite DEBUG noise too - #710
Merged
Merged
Conversation
The earlier ``_granian`` filter (#704) didn't catch the close-frame DEBUG messages users were still seeing — those originate from the ``tungstenite`` and ``tokio_tungstenite`` crates that Granian uses for the WebSocket layer, not from ``_granian`` itself. pyo3-log routes Rust tracing targets to Python loggers, mapping ``::`` → ``.`` so e.g. ``tungstenite::protocol`` arrives as the Python logger ``tungstenite.protocol``. Filtering the bare crate name applies hierarchically to all submodules. Verified by applying the dictConfig and reading effective levels: ``tungstenite.protocol`` and ``tokio_tungstenite.compat`` now resolve to INFO with ``isEnabledFor(DEBUG) == False``; root stays at DEBUG so codex code is unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The earlier
_granianfilter (#704) didn't actually silence the WebSocket close-frame DEBUG noise users were still seeing. Those messages originate from thetungstenite/tokio_tungstenitecrates that Granian uses for its WS layer, not from_granianitself.pyo3-log routes Rust tracing targets to Python loggers, mapping
::→., so e.g.tungstenite::protocolarrives as the Python loggertungstenite.protocol. Filtering the bare crate name applies hierarchically to all submodules.Test plan
make lint-pythoncleanmake tycleanpytest tests/clean (26 passed)tungstenite.protocoleffective level →INFO,isEnabledFor(DEBUG) → Falsetokio_tungstenite.compateffective level →INFO,isEnabledFor(DEBUG) → False_granian.asgi.ioeffective level →INFO(existing filter still works)DEBUG(codex code unaffected)Note
make lint(the wrapping script, not the underlying tools) errors onnginx/http.dwith "Cannot process specified file: it's ignored" — reproducible without my changes, so unrelated. Worth fixing separately.🤖 Generated with Claude Code