rich icon indicating copy to clipboard operation
rich copied to clipboard

Add the `log_omit_repeated_times` option to `Console`

Open apcamargo opened this issue 3 years ago • 4 comments

Type of changes

  • [ ] Bug fix
  • [x] New feature
  • [ ] Documentation / docstrings
  • [ ] Tests
  • [ ] Other

Checklist

  • [x] I've run the latest black with default args on new code.
  • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • [ ] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

This PR adds a log_omit_repeated_times option to the Console constructor. When set to False, the omission of repeated times by log() methods is disabled.

apcamargo avatar Feb 28 '22 17:02 apcamargo

Hey @willmcgugan. Is this a feature that could be considered? If so, do I need to add anything to the PR?

apcamargo avatar Mar 18 '22 19:03 apcamargo

Codecov Report

Merging #2013 (4eb6aff) into master (75f4637) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2013   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          71       71           
  Lines        7058     7058           
=======================================
  Hits         7045     7045           
  Misses         13       13           
Flag Coverage Δ
unittests 99.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/console.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update aa4546a...4eb6aff. Read the comment docs.

codecov-commenter avatar Mar 27 '22 21:03 codecov-commenter

The constructor already has a large argument list. I'd prefer not to add to it without good reason.

What is your use case? Why do you not want identical times removed from the log function?

willmcgugan avatar Mar 27 '22 21:03 willmcgugan

In my case, I wanted to be able to grep a log and be able to check the time it was recorded. But my motivation to write this PR was just because it made sense to me to have feature parity.

apcamargo avatar Mar 28 '22 15:03 apcamargo

This option makes sense for logging, but less so for Console.log. Not worth adding yet another option. Thanks for the contribution.

willmcgugan avatar Mar 04 '23 11:03 willmcgugan