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

Change default logging.yml to use RichHandler 1: initial setup #1512

Closed
Tracked by #1461
antonymilne opened this issue May 6, 2022 · 2 comments · Fixed by #1569
Closed
Tracked by #1461

Change default logging.yml to use RichHandler 1: initial setup #1512

antonymilne opened this issue May 6, 2022 · 2 comments · Fixed by #1569
Assignees

Comments

@antonymilne
Copy link
Contributor

antonymilne commented May 6, 2022

🥳 FUN TICKET 🥳 Prerequisites: #1470 and #1469. Based off point 2 of #1464

  • add rich as a core kedro dependency
  • add the following handler to framework-side logging.yml
rich:
    class: rich.logging.RichHandlers
  • for any loggers that have console listed under the handlers (probably just root), swap console for rich. Leave the console handlers still defined though
  • make the same change in the project-side logging.yml (+ starters + e2e test)
  • play around with the different options that are possible under rich - read https://rich.readthedocs.io/en/stable/reference/logging.html and https://rich.readthedocs.io/en/stable/logging.html to see what these are
    • there should be no need to set level but check this works right (should show messages >= INFO for kedro, >= WARNING for all other loggers)
    • generally play around with the options - probably the defaults are suitable for the most part but feel free to be creative, see what looks nice with a kedro run, e.g. do we want to set log_time_format: [%X]?
    • don't change any options for tracebacks; that is for Change default logging.yml to use RichHandler 2: fancy tracebacks #1513
    • don't set markup: True. Since we're modifying the root logger that would be too risky as other libraries might not be rich-aware and use [] that breaks stuff. We'll do markup for kedro logging in another ticket
  • test thoroughly to check that kedro run looks nice and what happens if you emit log messages from outside the kedro logger
  • test what happens if you do session.run in ipython and jupyter
  • add docs to explain how a user could switch back from rich to console by modifying their project-side logging.yml As in Write documentation on how to make a custom logging.yml in your project #1474, this should be as easy as possible
@datajoely
Copy link
Contributor

Could we make the markup=False configurable?

@antonymilne
Copy link
Contributor Author

It will be - I just added more detail to the ticket to explain this. I'm very keen on using markup=True where we can in a follow-up ticket, just don't want to apply it to all loggers in the first step here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants