Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to hide framework frames #1263

Open
jonashaag opened this issue Dec 26, 2024 · 3 comments
Open

Add ability to hide framework frames #1263

jonashaag opened this issue Dec 26, 2024 · 3 comments

Comments

@jonashaag
Copy link
Contributor

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.

@Delgan
Copy link
Owner

Delgan commented Dec 30, 2024

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.

@jonashaag
Copy link
Contributor Author

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.

@Delgan
Copy link
Owner

Delgan commented Dec 31, 2024

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants