Open Ninerian opened 2 years ago
Thanks, Daniel for raising this issue and providing the sandbox — much appreciated. Let me delve into this issue, sounds like a fun topic. It might take a while as I'm pretty busy right now.
In case you wanna tackle it and submit a PR: go for it 😉
Hello thanks for this library. It is really useful.
After working a while with it, I wanted to use the redact feature of pino to remove some sensitive information from the loglines. Unfortunately I found an unwanted behavior.
In this sandbox I've added a minimal example where I both defined the redact property in the
pino
andhapiPino
property of the laabr options. The property in the hapiPino setting is completely ignored, as the Pino instance is created inside thelogger.js
without passing the options to Pino. When hapi-pino is initialized, it reuses the pino instance, but is unable to inject the redact settings, as they are used at the construction of Pino.When the property in the pino setting is enabled, an exception is thrown. This results from the redact function which returns a string, this is then passed to the prettifier function in laabr. At the validation step for the preformatter an error is thrown, as it expects an Object.
I hope this helps to find a solution for this bug.