Skip to content
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

Listen to Kedro's log without the rich markup #4487

Open
noklam opened this issue Feb 17, 2025 · 3 comments · May be fixed by #4496
Open

Listen to Kedro's log without the rich markup #4487

noklam opened this issue Feb 17, 2025 · 3 comments · May be fixed by #4496
Labels
Issue: Feature Request New feature or improvement to existing feature

Comments

@noklam
Copy link
Contributor

noklam commented Feb 17, 2025

Description

Terminal:
Image

Application:
Image

Context

It is perfectly fine to have the rich mark up when I have rich installed, but I also want to listen to the Kedro log handler so I can export these logs to external application.

The mark up syntax are recorded as part of the log and there doesn't seem to be a way to remove it completely. The only thing that I can do is to remove rich completely. Ideally I can keep rich at the terminal/client, but having a way to export the log message without the rich mark up.

@noklam noklam added the Issue: Feature Request New feature or improvement to existing feature label Feb 17, 2025
@astrojuanlu
Copy link
Member

This is connected to #3626, addressed in #3682. This is the key point.

Ideally I can keep rich at the terminal/client, but having a way to export the log message without the rich mark up.

@noklam about this comment:

there doesn't seem to be a way to remove it completely

Shouldn't it be possible to change it in our logging.yml?

@noklam
Copy link
Contributor Author

noklam commented Feb 18, 2025

@astrojuanlu It's possible to remove rich logger, but that's not what I want to do. I want to keep Kedro default as is, but having my own log handler to do application specific work (i.e. log to mlflow). I will try to work out a PR today, if not I can at least provide a test case so you can quickly validate this.

At the moment the root cause is right now the log is done at DataCatalog level:

Image

So as long as one of the LogHandler is RichHandler, all handler will receive the markup log. My proposal is to move that markup logic to kedro.logging.RichHandler

Thread in Hall: https://kedro.hall.community/exporting-logs-without-rich-markup-syntax-W9ZtTY0L6rKS

@astrojuanlu
Copy link
Member

Indeed:

self._logger.info(
"Loading data from %s (%s)...",
_format_rich(name, "dark_orange") if self._use_rich_markup else name,

@noklam noklam linked a pull request Feb 18, 2025 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Feature Request New feature or improvement to existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants