pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

Pretty JSON #508

Closed kilianc closed 6 years ago

kilianc commented 6 years ago

Currently pino supports prettyPrint that requires pino-pretty as peer dependency and formats the output.

My understanding is that pino doesn't support in-process logs transformation/processing and it prefers to delegate using an out-of-process program. Basically using *nix pipes.

In our case we would like to use JSON.stringify(log, null, 2) for logs when developing locally without piping things together. In practice we want to replace pino-pretty with a new module.

I don't see a way of doing this correctly today unless I mokey-patch the require call.

Would you accept a PR that accepts prettyJSONPrint as option and a new module called pino-pretty-json? Alternatively passing the name of the module to prettyPrint instead of just true/false.

cc/ @Arun4rangan

jsumners commented 6 years ago

Please read the documentation. This is already a supported feature -- https://github.com/pinojs/pino/blob/master/docs/pretty.md

kilianc commented 6 years ago

@jsumners awesome! didn't see that bit!

kilianc commented 6 years ago

@jsumners one more thing: useLevelLabels and changeLevelName don't seem to affect the object passed to prettifier. I think this is by design reading the documentation. I think this is counterintuitive since those options are passed in the constructor.

I just wanted to confirm that this is expected and not a bug and won't change.

jsumners commented 6 years ago

I can't say they won't change. A PR could be submitted with a strong argument for implementing such. But the current implementation of those options do not have anything to do with prettfication. Indeed, the useLevelLabels option has an explicit note in the documentation that it is incompatible with transports.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.