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

Indent logs with a context manager #1110

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

atugushev
Copy link
Member

@atugushev atugushev commented Apr 19, 2020

Introduces new context manager LogContext.intentation(). Usage:

from piptools.loggin import log

log.debug("Hello")

with log.indentation():
  log.debug("World!")

Output:

Hello
  World!

Addresses #1109 (comment).

Changelog-friendly one-liner: Indent logs with a context manager.

Contributor checklist
  • Provided the tests for the changes.
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@atugushev atugushev added logging Related to log or console output refactor Refactoring code labels Apr 19, 2020
@codecov
Copy link

codecov bot commented Apr 19, 2020

Codecov Report

Merging #1110 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1110   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files          35       36    +1     
  Lines        2505     2540   +35     
  Branches      312      312           
=======================================
+ Hits         2491     2526   +35     
  Misses          8        8           
  Partials        6        6           
Impacted Files Coverage Δ
piptools/logging.py 100.00% <100.00%> (ø)
piptools/repositories/pypi.py 93.25% <100.00%> (+0.07%) ⬆️
piptools/resolver.py 100.00% <100.00%> (ø)
piptools/scripts/compile.py 100.00% <100.00%> (ø)
tests/test_logging.py 100.00% <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 6847146...fa9fd3c. Read the comment docs.

Introduces new context manager `LogContext.intentation()`. Usage:

```python
from piptools.loggin import log

log.debug("Hello")

with log.indentation():
  log.debug("World!")
```

Output:

```
Hello
  World!
```
@atugushev atugushev mentioned this pull request Apr 19, 2020
3 tasks
@atugushev atugushev requested a review from AndydeCleyre April 20, 2020 13:22
Copy link
Contributor

@AndydeCleyre AndydeCleyre left a comment

Choose a reason for hiding this comment

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

All very nice!

@atugushev atugushev modified the milestone: 5.1.0 Apr 21, 2020
@atugushev
Copy link
Member Author

Since it's not user-facing I won't assign it to the milestone.

@atugushev atugushev merged commit a33e653 into jazzband:master Apr 21, 2020
@atugushev atugushev deleted the logs-indentation branch April 21, 2020 18:21
@atugushev
Copy link
Member Author

Thank you, @AndydeCleyre, for reviewing this! Much appreciated 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging Related to log or console output refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants