Repository navigation
Respect the log facade's level filters in LogFacadeWriter - #1167
Merged
Merged
Conversation
LogFacadeWriter passed records straight to `log::logger().log()`, so records above the facade's `max_level()` or `STATIC_MAX_LEVEL` still reached the application's logger. Apply the same checks as the `log` macros before building the record. The unit tests that use the global facade logger now share one logger and a lock, since the logger can only be set once per process. Written with the help of an AI assistant (Claude); reviewed and tested by me.
|
I've assigned @tnull as a reviewer! |
tnull
reviewed
Oct 14, 2026
tnull
left a comment
Collaborator
There was a problem hiding this comment.
Production changes look good, but let's just drop the test changes. I'm not sure it's worth testing this to begin with, but the lock also risks having concurrent tests block on each other.
As requested in review, keep only the LogFacadeWriter change.
Contributor
Author
|
Dropped the test changes, so the PR now only touches the writer. |
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.
Fixes #1139.
Writer::LogFacadeWriterbuilt alog::Recordand passed it tolog::logger().log(). That skips the checks thelogmacros perform first,level <= STATIC_MAX_LEVEL && level <= log::max_level(). An application that callslog::set_max_level(LevelFilter::Error)still gotInfo,DebugandTracerecords from LDK Node.The writer now maps the level first and returns early when it fails either check, under both
unifficonfigurations. The level mapping, target, module path, line and structured context are unchanged. It doesn't consultLog::enabled(), matching what the macros do.cargo test --lib logger::passes, with and without--features uniffi.AI disclosure: written with the help of an AI assistant (Claude), then reviewed and tested by me.