-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Hey Will,
Been working with rich now for about a month now and I absolutely love it, moving a lot of my projects over to using the library. One thing I'd like to do is to capture the exception output from log.exception() when using RichHandler.
The formatting is perfect and concise for what I need, and I don't care much about the color. My destination is a discord bot, and not the console, so I most only care about the formatting of the traceback.
I tried doing something like ..
# if unhandled, propogate up to the CLI
try:
raise error.original
except Exception as e:
with rich.console.Console().capture() as cap:
log.exception(e)
s = cap.get() # ==> ''... but it looks like that's slicing the buffer of the newly created console and totally ignoring the log handler - which makes sense to me considering we're using two different consoles at that point. Unfortunately, I'm at a loss on how to grab/rebuild the renderable and would love your thoughts.
