Closed WoodyWoodsta closed 2 years ago
This would be nice, for example in my case, I want to include only req.headers.host
and ignore everything else in req.headers.*
. , I currently have to explicitly add all possible headers to ignore list which is not ideal since we have no control on what will be giving in request headers.
This feature could be the right solution for my case.
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
We've since rolled our own formatter as we needed a lot more than this change. If I find the time I'll contribute, but this is looking unlikely at the moment.
Hey lemme take this one! If @WoodyWoodsta haven't had time for it.
No time for it - go ahead!
Our use case of pino is to include contextual info under 1 log key (like
data
). During development, we're only really interested in this key, along with the top log line output (timestamp, message, etc).The options for pino-pretty don't allow us to ignore all keys except for
data
, unless we ignore keys exhaustively. This means we have to understand all possible keys in the object, and have to keep updating this list as we find more keys to ignore. This isn't really sustainable.Proposal
Add an option
only
, orselect
, which will select the keys to output, and will overrideignore
if they are both given.