Replies: 2 comments
-
You can capture output from Rich and send that to logging. But bear in mind most loggers will not be aware of color codes, and some may break Rich formatting. |
Beta Was this translation helpful? Give feedback.
0 replies
-
from rich.pretty import pretty_repr
logging.info(pretty_repr(my_dict)) Alternatively: from pprint import pformat
logging.info(pformat(my_dict)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to beautifully print a dictionary. I want to get the output of
But I want to log it as info, not a direct print.
I have used rich's handler for logging. And logging works perfectly fine. The logs are colorized and styled as I need. But the dictionary is not pretty printed. It is colorized when I log it, but I need the output of pretty print, but inside a log.
How can I do so ?
I tried this, but did not work
Beta Was this translation helpful? Give feedback.
All reactions