loguru
loguru copied to clipboard
Add ability to hide framework frames
Some frameworks/libraries produce very long stacks. Loguru already highlights the user frames using colors. I'd like to be able to hide framework frames altogether.
I'd be happy to implement this using a custom ExceptionFormatter. I think the right place would be to extend _extract_frames().is_valid(). Would you be open for a PR that makes it possible to overwrite this function without copying all of the code?
If we wanted to go a step further we could even make this an official feature: Given a list of files or modules, Loguru skips those when printing exceptions.
Hey. Thank you for your suggestion.
The problem is that currently, ExceptionFormatter isn't publicly available. The class can surely be extended, but you would still need to import it from a private Loguru's module. :/
However, as there have been several features requests to improve exception formatting, I'm considering making it more easily configurable. Then, we could seamlessly add the ability to skip frames. I've not yet defined the final API, though.
Sounds great!
In the meantime, are you interested in a tiny PR to make overwriting frame selection possible? Even if it's using internal modules, better than nothing.
In the meantime, are you interested in a tiny PR to make overwriting frame selection possible? Even if it's using internal modules, better than nothing.
Sure, if it's of any use to you why not. :+1: