New output formats#146
Draft
DrJosh9000 wants to merge 9 commits into
Draft
Conversation
77eb235 to
73493ce
Compare
Undo format option for webservice, and tweak the flag usage strings
7bae2ad to
86a933a
Compare
|
@DrJosh9000 Mind including some example of the json log output here? |
Contributor
Author
Added to the description. |
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.
This adds two new flags:
--format, which can be one ofhtml,plain,json, orjson-plain, and--timestamp-format, which controls the output format of timestamps in plain modehtmlis what we do today, and remains the default.plainis useful for a human investigating logs in a text editor, where ANSI escape sequences would get in the way.jsonandjson-plainstructure each line as a JSON object, which is more easily consumed by machine, keeping the line content and line metadata (timestamp) separate.Since removing all ANSI escapes in
plainmode would drop timestamp codes, it makes sense to have a way to optionally include the timestamps inplainoutput, with some configurable formatting. Hence--timestamp-format.There's a case for making
--timestamp-formathave useful effects when usinghtmlformat, but this requires a bit of thought (both the timestamp format itself, and the XML processing instruction "element" containing it, should be configurable).Example outputs
cat fixtures/playwright.sh.raw | terminal-to-html --format=plaincat fixtures/weather.sh.raw | terminal-to-html --format=plaincat fixtures/playwright.sh.raw | terminal-to-html --format=jsoncat fixtures/weather.sh.raw | terminal-to-html --format=json