pinojs / pino

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

Best practice: Prettify both HTTP request logs and "normal" log messages #651

Closed jfahrenkrug closed 1 year ago

jfahrenkrug commented 5 years ago

Hi,

I'm a little stuck and want to make sure I'm doing the right thing. I have a Node server that I just converted to using Pino for logging. It works very well, but the express-pino-logger messages are very verbose. I understand that it's the job of another process to prettify the JSON log messages. pino-pretty keeps the verbosity of the HTTP request logs. pino-http-print nicely formats the HTTP request logs, but it filters out my other log messages.

So I can either have all my log message and very verbose HTTP logs, or I can have nicely formatted concise HTTP logs, but none of my other log messages. What's the best way to solve this? Is it only solvable by implementing my own prettifier? If so, it would be great to have an option on pino-pretty to prettify HTTP logs, since that seems a very common use case.

Thanks so much!

mcollina commented 5 years ago

I think the best approach would be for pino-http-print  to route the messages that are not http logs to pino-pretty internally (maybe with a flag). Would you like to send such a PR?

jfahrenkrug commented 5 years ago

@mcollina Sounds good! I'll put up a PR.

jfahrenkrug commented 5 years ago

@mcollina PR is up: https://github.com/pinojs/pino-http-print/pull/1

github-actions[bot] commented 1 year 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.