Join the Kedro community

Updated 2 days ago

Exporting logs without rich markup syntax

Is there a way to export logs without the Rich mark up syntax? Rich works perfectly fine at the terminal, the problem is I don't need them when I am not using a terminal (i.e. export to a different application, log store etc)

GH: https://github.com/kedro-org/kedro/issues/4487

Attachments
image.png
image.png
N
E
L
11 comments

At the moment the markup flag is set per DataCatalog rather than logHandler level, so I can only have all or none of my logHandlers use the markup logs.

@Laura Couto, any thoughts on this?

Let me take a look

I tried these methods but it doesn't work:

  • Add my own loghandler instead of using Kedro's one

It still does not work because the log message come with the mark up. Once it is embedded in the message, the only way to remove it is to use regex, which is not reliable when the log message may contains bracket or so.

I wonder if it is possible to remove the markup at the log message level. So the mark up is only added by the Kedro.RichHandler

Would have to do some exploration on that and see if we can move the calls to _format_rich somewhere else. For now, I think the quick solution is not using the Rich handler at all, even on the terminal

this is something I do not want to do since I don't control the project run but rather collect information during runs. But I understand this seems to be only workaround for now

^if it's possible to move it out of the catalog, would such change be accepted?

If it maintains the functionality I don't personally see why not.

I think I find a solution that solve all the problems.

Cc @juanlu

https://github.com/kedro-org/kedro/pull/4496

^ I haven't fixed the test yet but would like to get some opinion on the approach first

I fixed the test now so it's ready for review.

Add a reply
Sign up and join the conversation on Slack