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

Fixes issues with incorrect indentation #97

Merged
merged 1 commit into from Nov 3, 2021
Merged

Fixes issues with incorrect indentation #97

merged 1 commit into from Nov 3, 2021

Conversation

dmikusa
Copy link
Contributor

@dmikusa dmikusa commented Nov 3, 2021

Summary

Given a situation where bytes were written to the logger that do not end with a newline, then another set of bytes are written, the second set of bytes would be indented incorrectly. For example. First, write some-data, then write more-data\nindent. It should log some-datamore-data\n indent, but it actually writes some-data more-data\n indent. There should not be an indent between the two writes because we only indent after a newline.

Use Cases

This caused issues when indenting output from commands like mvn and cargo.

This PR resolves the issue and adds tests to confirm correct output.

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

Given a situation where bytes were written to the logger that do not end with a newline, then another set of bytes are written, the second set of bytes would be indented incorrectly. For example. First, write `some-data`, then write `more-data\nindent`. It should log `some-datamore-data\n    indent`, but it actually writes `some-data    more-data\n    indent`. There should not be an indent between the two writes because we only indent after a newline.

This caused issues when indenting output from commands like `mvn` and `cargo`.

This PR resolves the issue and adds tests to confirm correct output.

Signed-off-by: Daniel Mikusa <dmikusa@vmware.com>
@dmikusa dmikusa added type:bug A general bug semver:patch A change requiring a patch version bump labels Nov 3, 2021
@dmikusa dmikusa requested a review from a team November 3, 2021 02:27
@dmikusa dmikusa merged commit 77ff334 into main Nov 3, 2021
@dmikusa dmikusa deleted the fix-indent branch November 3, 2021 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump type:bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant