Open rayvincent-bsd opened 5 years ago
This is exactly what I'm looking for. Any info on this?
I have this working as advertised here: https://github.com/rayvincent-bsd/pino-pretty/tree/v2.6.1-rc.1
Though, this PR hasn't been approved and has lost momentum. And since then, the code has been refactored which would require further updates to allow the PR to be considered again. https://github.com/pinojs/pino-pretty/pull/55
Thanks! I'll take a look at this when I'll go back to my project.
This tool is exactly what I'm after, but I was hoping that it would be a little easier to format the log that's output before the message is appended. I've built a solution and am hoping that it can be adopted into the project. I see room here to provide configuration logic that can allow specifying what keys and delimiters should be rendered.
Rather than make a separate transport, I took a stab at adding a feature that would provide this the flexibility I was looking for. This issue is going to be followed by a PR for review.
My specific use case, was to bind the module and method to each log entry and have them show in a format that's easy to digest. I found a lot of modules that wrap pino and leverage CallSite, but that doesn't help with my minified code. So I went with this approach:
I will then take it upon myself and the team to manually bind
fn
when logging within the context of a specific function. Now I get logs that look like this:[2019-03-02 13:43:35.942 +0000] DEBUG (61924) [app] [server] Start the Application [2019-03-02 13:43:35.946 +0000] TRACE (61924) [app] [api/mqtt/Client] [constructor] Client Created [2019-03-02 13:43:35.947 +0000] TRACE (61924) [app] [api/mqtt/Client] [connect] start [2019-03-02 13:43:35.947 +0000] TRACE (61924) [app] [api/mqtt/Client] [connect] end [2019-03-02 13:44:20.324 +0000] INFO (61924) [app] [server] SIGINT received, closing process