node-bunyan
node-bunyan copied to clipboard
Using pino-noir with bunyan
I can't find much documentation on using pino-noir with bunyan. Does Bunyan have an opinion on this?
I'm asking as the way Bunyan serializers do redaction seems a bit incomplete to me. For eg:
const REDACTED = '<REDACTED>';
function reqSerializer(req) {
if(!req) return req;
return {
...bunyan.stdSerializers.req(req),
password: REDACTED,
someProp: REDACTED,
}
}
If the request does not contain the someProp
property, it will still get logged as <REDACTED>
. Whereas using pino-noir
like so works like a charm i.e. it doesn't log any properties as redacted when it does not exist in the req object.
const redactionKeys = {
keys: [ 'firstName', 'password']
}
bunyan.createLogger({
name: 'some_name',
serializers: noir(bunyan.stdSerializers, redactionKeys.keys),
})
Is it possible that bunyan might drop support for pino-noir
in the future? or rather, can I depend on this integration working in the future?