Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using pino-noir with bunyan #666

Open
nkhil opened this issue Apr 27, 2021 · 0 comments
Open

Using pino-noir with bunyan #666

nkhil opened this issue Apr 27, 2021 · 0 comments

Comments

@nkhil
Copy link

nkhil commented Apr 27, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant