Skip to content

fix: set faststream log level on logger before injecting into broker#77

Merged
lesnik512 merged 1 commit intomainfrom
fix/faststream-received-processed-log-filtering
Apr 28, 2026
Merged

fix: set faststream log level on logger before injecting into broker#77
lesnik512 merged 1 commit intomainfrom
fix/faststream-received-processed-log-filtering

Conversation

@lesnik512
Copy link
Copy Markdown
Member

LoggerState.set_level() was being called after assigning ManualLoggerStorage, which set both the underlying logger threshold AND LoggerState.log_level to WARNING. Since FastStream logs Received/Processed without an explicit level, it used LoggerState.log_level — so messages were submitted at WARNING and passed the filter.

Fix: call setLevel() on the structlog logger directly before passing to ManualLoggerStorage, leaving LoggerState.log_level at its INFO default. Messages are then submitted at INFO and dropped by filter_by_level against the WARNING threshold.

LoggerState.set_level() was being called after assigning ManualLoggerStorage,
which set both the underlying logger threshold AND LoggerState.log_level to WARNING.
Since FastStream logs Received/Processed without an explicit level, it used
LoggerState.log_level — so messages were submitted at WARNING and passed the filter.

Fix: call setLevel() on the structlog logger directly before passing to
ManualLoggerStorage, leaving LoggerState.log_level at its INFO default.
Messages are then submitted at INFO and dropped by filter_by_level against
the WARNING threshold.
@lesnik512 lesnik512 self-assigned this Apr 28, 2026
@lesnik512 lesnik512 merged commit 53334b9 into main Apr 28, 2026
7 checks passed
@lesnik512 lesnik512 deleted the fix/faststream-received-processed-log-filtering branch April 28, 2026 12:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...bootstrap/bootstrappers/faststream_bootstrapper.py 100.00% <100.00%> (ø)
tests/test_faststream_bootstrap.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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