Replies: 1 comment
-
Hi @astrochun , I just started using Rich, and looking for exactly this. Can you share the solution if you were able to figure it out. TIA |
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
-
I have a FastAPI application where I previously configured stdout and file logging using the python
logging
standard library. Here, I'm using YAML for configuration for both the application anduvicorn
log. I'm now working on migrating this to use Rich.I'm able to configure the console logs to use Rich. The YAML config looks something like this:
However, I wonder if there's a way to pass a
Rich
Formatter withTimedRotatingFileHandler
as I do like rich text and would like for mylog.*()
to appear as it would be in the log (albeit rich color would not be available but at least emoji will be handled).I know there's a way to specify a
Console
withfile=open(...)
, but don't think rotating file is supported withinRich
. Thus, I think replacing the formatter used inprecise
may be the best solution. Has anyone done this or know how?Beta Was this translation helpful? Give feedback.
All reactions