only prefix lines with the elapsed time in the streams.log#33
Merged
dirk-thomas merged 1 commit intomasterfrom Jun 19, 2020
Merged
Conversation
This was referenced Jun 19, 2020
cottsay
approved these changes
Jun 19, 2020
Member
cottsay
left a comment
There was a problem hiding this comment.
Looks good to merge, one thought though.
Comment on lines
+119
to
+125
| if filename == ALL_STREAMS_LOG_FILENAME: | ||
| # prefix line with relative time | ||
| relative_time = time.monotonic() - self._start_times[job] | ||
| # use the same encoding as the default for the opened file | ||
| prefix = ('[%.3fs] ' % relative_time).encode( | ||
| encoding=locale.getpreferredencoding(False)) | ||
| h.write(prefix) |
Member
There was a problem hiding this comment.
This seems fine, but I'm curious if you could write the prefix to the streams log explicitly outside of the loop. Just a thought.
Member
Author
There was a problem hiding this comment.
That would be possible. But then I would need to get the file handle explicitly. So not sure if that would reduce any logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up of #25.
The elapsed time prefix to each line in the log files is helpful for the user to know the point in time a line was printed. But in some cases the unaltered output is needed, e.g. to extract compiler warnings in Jenkins. In those cases the extra prefix is unexpected and confuses out-of-the-box software.
Therefore this PR removes the prefix from all log files but the
streams.log. That allows to feed logs likestdout_stderr.logto tools like the Jenkinswarnings-ngplugin while still providing users a complete log with timestamps on each line to introspect when certain output appeared and certain commands started / finished.