Skip to content

Conversation

@nason
Copy link
Contributor

@nason nason commented Jan 24, 2017

If a log method is called with an object as its first argument, bunyan treats it specially as context. Values are passed through serializers, which are usually much more effective than traversing the entire object with hide-secrets.

This change makes it so that scrub does not touch values of a context object when a serializer has been provided. This should help performance because we no longer need to traverse large, circular req and res objects.

I'll be adding tests around this as a follow up.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.4%) to 75.221% when pulling e571649 on fix-scrub-2 into 93f55cf on master.

Copy link
Contributor

@mattjstar mattjstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Maybe it's worth adding a TODO to write a test to get top level context fields scrubbed too, like the changed test used to cover? ...Though that's not a big deal for now as it would be fairly dumb to explicitly pass in { credit_card: 'MY SECRET CARD' } directly into the context.

@nason nason merged commit 3f66a7a into master Jan 24, 2017
@nason nason deleted the fix-scrub-2 branch January 24, 2017 21:26
@nason
Copy link
Contributor Author

nason commented Jan 24, 2017

Maybe it's worth adding a TODO to write a test to get top level context fields scrubbed too

Noted. Will handle this + test in a follow up

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

Successfully merging this pull request may close these issues.

4 participants