Open zdila opened 3 years ago
Do you know if there is a module that could do that on the terminal?
Quickly googled for example https://www.npmjs.com/package/json-colorizer
I would prefer an example that does not depend on Chalk, but overall it's a good feature to have.
@mcollina Opened https://github.com/joeattardi/json-colorizer/issues/24, let's see what their stance is.
@mcollina In case there is no timely response, how would you feel about a PR embedding the json-colorizer functionality inside pino-pretty? It is a fairly small amount of code.
no prob
@mcollina Any recommendations on where in existing codebase to plug in JSON colourizing?
Not really, I would put it in a separate file for the ease of testing.
@mcollina Oh yes, that I would, I was more curious about where to invoke it from within existing code.
https://github.com/pinojs/pino-pretty/blob/e5e3f5473d76844615e17d67a1e9b55bb20d6385/lib/utils.js#L346 seems a good function to start with.
FYI I've forked the repo to use colorette, so we could potentially use my fork here: https://www.npmjs.com/package/@capaj/json-colorizer
If we need to fork I prefer it to live in the pino org: anyway, good work!
Could you start integrating that here?
not sure if I have access there, but I can fork my fork there if I do.
no I don't have access there. If you invite me, I can fork and publish it on npm under @pino/json-colorizer
You should be able to transfer the repo to this org. I'll handle the publish later.
when I try to transfer I get
One has to be a member of the org to transfer repos to the org.
Here it is: https://www.npmjs.com/package/@pinojs/json-colorizer.
Could you send a PR to integrate it? Thanks!
What's the status on this one? :) Could really use this. 🥇
Currently JSON is printed with single color. It would be nice to add syntax highlighting which would make it easier to read especially in the single-line mode.