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

[WIP] Plain ndjson #58

Merged
merged 34 commits into from Apr 28, 2019
Merged

[WIP] Plain ndjson #58

merged 34 commits into from Apr 28, 2019

Conversation

jsumners
Copy link
Member

@jsumners jsumners commented Mar 30, 2019

This PR will refactor pino-pretty to be a generic ndjson prettifier. It will recognize various properties that are common in ndjson log lines, and handle those properties in a sane way, but it will no longer skip JSON lines it does not recognize. Instead, it will apply a basic format to them.

TODO:

  • Figure out what format bog standard JSON lines should be presented in (I do not have time for this)
  • Clean up the mess that is object and errors formatting
  • Write some tests for the new utility functions
  • Docs!

For the formatting of standard JSON lines I'm thinking:

{"foo":"bar"}

=>

{
  foo: "bar"
}

and

["foo","bar"]

=>

[
  "foo",
  "bar"
]

Opinions @pinojs/core?

@jsumners
Copy link
Member Author

PS: PRs to this branch are welcome if you see something you want to tackle.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 135

  • 75 of 75 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.0%) to 96.939%

Totals Coverage Status
Change from base Build 123: -1.0%
Covered Lines: 167
Relevant Lines: 167

💛 - Coveralls

@coveralls
Copy link

coveralls commented Mar 30, 2019

Pull Request Test Coverage Report for Build 194

  • 147 of 147 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.4%) to 99.415%

Totals Coverage Status
Change from base Build 187: 1.4%
Covered Lines: 193
Relevant Lines: 193

💛 - Coveralls

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Good work, I think you can go ahead and drop node 6 as well.

@jsumners
Copy link
Member Author

I intend to.

@jsumners
Copy link
Member Author

FYI: stack formatting is a nightmare.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

jsumners and others added 7 commits April 9, 2019 18:53
@jsumners
Copy link
Member Author

I think this is as done as I have time for. It would be nice to get a robust set of sample data to feed through it to at least generate a screenshot for the readme, but that can be a "good first issue" or I will come back to it later. We might as well wait for Node 12 to be released before closing this out since it is so close and this PR drops Node 6.

In the meantime, if anyone can think of how to cover https://coveralls.io/builds/22789235/source?filename=bin.js#L45 in the tests, a PR is welcome. The only other block Coveralls thinks is not covered is most definitely covered as I have stepped through it via the test suite.

It would also be fantastic if someone with more patience and time for formatting would come through and make the output even prettier. But it's good enough as-is.

@jsumners jsumners merged commit 310da6a into master Apr 28, 2019
@jsumners jsumners deleted the plain-ndjson branch April 28, 2019 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants