-
Notifications
You must be signed in to change notification settings - Fork 909
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
Make rich markup compatible with file-based logs #2207
Comments
Custom
|
Following discussion in tech design on 22 February, we decided that it would be fine to go for option 1 (just leave it as it is and see if anyone complains about it). But given the discussion there, I think there's actually a better solution now: Revert #1663 and raise an issue/PR on rich to make colours that are used by rich for e.g. I think it's quite likely that such a change in rich itself wouldn't be feasible because we're only really interested in changing a few colours that we use in logging, so would we want to change just those few like So, assuming we can't change this on rich itself what we should do is just change the colours in our custom handler. This will be possible after #2277. We'd need some code like this:
and then pass This way we get the benefit of the accessibility but also file logging won't have weird tags in it. The only downside is that anything in |
@AhdraMeraliQB what do you think of the above? 🙂 |
The accessibility choices in #1663 primarily considered being able to differentiating Kedro's core elements/types from other quoted strings in log messages - specifically datasets and paths (nodes were handled by removing the quote marks entirely). This means the nodes, datasets, paths, numbers and other quoted strings should all be easy to tell apart at a glance. The default rich colour choices are still generally discernable from each other (string vs number etc). I do not see much added value in specifying dark orange over green for all strings. (This is also why raising a PR on Rich would likely be unhelpful - the elements where we consider accessibility are Kedro-specific) If we are to revert #1663, I don't think the second step would be necessary. |
This makes sense, thank you for the explanation @AhdraMeraliQB. In this case I propose that we leave it as it is now and see if anyone complains about it. I think it will be increasingly an edge case anyway following outcomes of #2149 which is likely to diminish importance of logging to files. And then if people do get upset about it we can revisit. |
Common guys, please remove those tags from the console logger... not a big deal ok but still quite annoying. Especially for customers. I'm working on migrating our models to kedro and I feel a bit sad to tell Data Scientists that there is bug in logs.. for a product we try to promote... |
@Zangetsu-GPO Thanks for the feedback, actually this is in the pipeline already. #3682, this will be fixed soon. |
@Zangetsu-GPO do any of these environment variables work for you today? |
#3682 was merged, closing. |
#1663 added to develop some rich markup tags like
[dark_orange]
to some key kedro log messages. This works great in all terminals (rich strips out the tags for dumb terminals that can't render the styles) but unfortunately not with kedro's file logging which will save logs like this:There's also a much less important inconsistency is that the format of messages logged to files are no longer consistent with the console output. e.g. in console you get
vs. in the log file:
There's various options here:
tee
rather than Python logging?'
)RotatingFileHandler
that strips out rich markup before emitting logs (see below for possible ways to do this)The text was updated successfully, but these errors were encountered: