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

Use fixed-width ISO8601 formatting #362

Merged
merged 2 commits into from
Mar 9, 2017
Merged

Use fixed-width ISO8601 formatting #362

merged 2 commits into from
Mar 9, 2017

Conversation

htrendev
Copy link
Contributor

@htrendev htrendev commented Mar 9, 2017

This is a minimal change of how the milliseconds part in iso8601 strings is formatted. Currently any trailing zeroes are removed, which produces different length time strings. Depending on tab size settings in terminal, this may results in level and message columns getting out of alignment (not observed in the example below, but happens in terminal if tab size is set to 4).

2017-03-09T17:47:10.499+0100	INFO	msg1
2017-03-09T17:47:10.5+0100	INFO	msg2
2017-03-09T17:47:10.501+0100	INFO	msg3
2017-03-09T17:47:10.51+0100	INFO	msg4

Keeping the trailing zeroes, preserves the alignment of log messages and makes it a bit easier on the eyes.

2017-03-09T17:47:10.499+0100	INFO	msg1
2017-03-09T17:47:10.500+0100	INFO	msg2
2017-03-09T17:47:10.501+0100	INFO	msg3
2017-03-09T17:47:10.510+0100	INFO	msg4

I'm not sure if such a change needs a test, but I'll write one if indeed required. Updated existing test to check for trailing zeroes.

Before opening your pull request, please make sure that you've:

Thanks for your contribution!

@mention-bot
Copy link

@htrendev, thanks for your PR! By analyzing the history of the files in this pull request, we identified @akshayjshah, @peter-edge and @jcorbin to be potential reviewers.

@CLAassistant
Copy link

CLAassistant commented Mar 9, 2017

CLA assistant check
All committers have signed the CLA.

@akshayjshah akshayjshah changed the title Produce same length ISO8601 time strings Use fixed-width ISO8601 formatting Mar 9, 2017
Copy link
Contributor

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Looks good - thanks for the fix!

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

Successfully merging this pull request may close these issues.

4 participants