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

When saving a traceback, shorten very large locals #3468

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

happz
Copy link
Collaborator

@happz happz commented Jan 14, 2025

A traceback in log.txt can be very large, especially when saving locals like a huge set of result or junit XML. Adding a level of traceback verbosity, locals, which will log locals, but shorten the very long ones. full will keep showing everything on terminal.

Pull Request Checklist

  • implement the feature
  • write the documentation

@happz happz added this to the 1.42 milestone Jan 14, 2025
@happz happz force-pushed the trim-locals-in-tracebacks branch from 1134196 to b62b592 Compare January 14, 2025 15:16
Copy link
Collaborator

@lukaszachy lukaszachy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick about the value, otherwise LGTM

#: Render also call stack for exception and each of its causes,
#: plus all local variables in each frame, trimmed to first 1024
#: characters of their values.
LOCALS = '2'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why '2' and not 'locals' ? It might be more descriptive, or?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may, I wanted to have a breathing space for the future, in case we find some new verbosity levels between full and the rest. full is easy, it's everything that can be shown, but finding names for verbose-but-not-so-verbose levels is harder. If there's a more verbose level after levels, how would it be called, and how would a user tell which of those names is the more verbose one? 2 vs 3 would be easy.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukaszachy pls re-review

@happz happz force-pushed the trim-locals-in-tracebacks branch from b62b592 to 5e7de3f Compare January 16, 2025 13:04
Copy link
Collaborator

@thrix thrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thrix thrix added ci | full test Pull request is ready for the full test execution documentation Improvements or additions to documentation code | utils Various utility functions and classes used across the code and removed documentation Improvements or additions to documentation labels Jan 21, 2025
@thrix
Copy link
Collaborator

thrix commented Jan 21, 2025

/packit test

happz added 2 commits January 21, 2025 21:56
A traceback in `log.txt` can be very large, especially when saving
locals like a huge set of result or junit XML. Adding a level of
traceback verbosity, `locals`, which will log locals, but shorten the
very long ones. `full` will keep showing everything on terminal.
@happz happz force-pushed the trim-locals-in-tracebacks branch from 5e7de3f to 769d50b Compare January 21, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution code | utils Various utility functions and classes used across the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants