pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

Add support for dot notation when accessing custom keys #438

Open dror-weiss opened 1 year ago

dror-weiss commented 1 year ago

Hello,

In Pino, I'm using its nestedKey feature with a custom time field that I want Pino-Pretty will parse. However, the --timestampKey supports only fields in the root of the log entry.

I would like to provide --timestampKey nested_key.time to be used as the time value.

This is also relevant to all custom keys the library allows to override.

mcollina commented 1 year ago

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

OlivierCuyp commented 1 month ago

Since this related, pino-pretty doen't handle well error display when using nestedKey on pino. Either pino-pertty allow dot notation for timestampKey& errorLikeObjectKeys or pino-pretty need to have a nestedKey option like pino.

@mcollina let us know which solution is preferred

mcollina commented 1 month ago

pino-pretty should have a nestedKey option too!