fix: prevent rich markup leakage to non-rich handlers#5200
Closed
CommitToday wants to merge 2 commits intokedro-org:mainfrom
Closed
fix: prevent rich markup leakage to non-rich handlers#5200CommitToday wants to merge 2 commits intokedro-org:mainfrom
CommitToday wants to merge 2 commits intokedro-org:mainfrom
Conversation
Signed-off-by: SoulSniper1212 <warush23@gmail.com>
merelcht
reviewed
Nov 10, 2025
| return any(isinstance(handler, RichHandler) for handler in logger.handlers) | ||
|
|
||
|
|
||
| def _has_only_rich_handlers(logger: logging.Logger | None = None) -> bool: |
Member
There was a problem hiding this comment.
Since this method is very similar to _has_rich_handlers, could we just use this new method everywhere instead?
merelcht
reviewed
Nov 10, 2025
Member
merelcht
left a comment
There was a problem hiding this comment.
Thanks for opening this PR @SoulSniper1212 ! ⭐ I haven't tried this properly yet, but left a quick question and ran the CI checks to see if they all run fine.
…andles-kedro-node-bra
Member
|
Hi @CommitToday are you still interested in working on this? |
Member
|
Hi @CommitToday ! I'm closing this due to inactivity. Feel free to re-open it if you want to continue working on it 🙂 |
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.
Overview
This PR addresses issue #5199 by preventing rich markup tags from leaking to file handlers when mixed logger handlers are present. The fix involves updating the logic that determines when to use rich markup in logging calls.
Checklist
Proof
The fix ensures that rich markup is only enabled when all handlers attached to a logger are RichHandlers. This prevents markup leakage to non-rich handlers like file handlers. The changes include:
_has_only_rich_handlersto check if all handlers are RichHandlers_has_rich_handlermarkup=Falseto Node logging calls to prevent markup in log messagesCloses #5199