-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Kedro logging broadcasting markup log message to all handlers. #4496
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Nok Lam Chan <[email protected]>
# Emit some logs | ||
assert not custom_handler.records | ||
catalog.save("dummy", data) | ||
assert custom_handler.records | ||
for record in custom_handler.records: | ||
assert "[dark_orange]" not in record.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should sufficiently show that even with a dummy handler, it still capture the rich markup.
@astrojuanlu
Signed-off-by: Nok Lam Chan <[email protected]>
Signed-off-by: Nok Lam Chan <[email protected]>
Signed-off-by: Nok Lam Chan <[email protected]>
@@ -54,3 +57,20 @@ def __init__(self, *args: Any, **kwargs: Any): | |||
# fixed on their side at some point, but until then we disable it. | |||
# See https://github.com/Textualize/rich/issues/2455 | |||
rich.traceback.install(**traceback_install_kwargs) # type: ignore[arg-type] | |||
|
|||
def emit(self, record: LogRecord): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trick here is to keep the raw message without markup language. The handler will be responsible to add the [brackets] (I believe this is how rich.RichHandler
functions anyway)
Signed-off-by: Nok Lam Chan <[email protected]>
Description
Development notes
Kedro.logging.RichHandler
.LogRecord
and raw message without markup.Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file