[REQUEST] Demo how to work in conjunction with `loguru`
See original GitHub issueHave you checked the issues for a similar suggestions? Yes
How would you improve Rich?
Loguru
is kind of a wrapper around the logging
library. I’ve seen in your docs that you can pass the RichHandler() to logging
to generate “rich” logs.
https://loguru.readthedocs.io/en/stable/api/logger.html#loguru._logger.Logger.configure
However in my current project, we are using loguru, so I’m trying to figure out how to do a similar thing (if it’s even possible), to pass RichHandler() to loguru, so I can generate these rich logs that are great.
It would be great if you could explain if this is possible, and if so share how it works, perhaps appending this detail to the rich docs here.
My naive attempt at getting this to work:
from loguru import logger
from rich.logging import RichHandler
logger.configure(handlers=[RichHandler()])
logger.debug("This is a debug statement")
logger.info("This is an info statement")
But I get fairly confused with the traceback. Hoping you may be able to enlighten me!
What problem does it solved for you?
It would enable me to use rich formatting on logs in conjunction with the loguru package. Perhaps other users of loguru would be interested in this as well.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10
Top GitHub Comments
Haven’t used loguru before, but I got it working with Rich. You were close, the
configure
method takes a list of dicts.Only thing I couldn’t figure out was how to change loguru date format.
This did not work for me 😦