-
Notifications
You must be signed in to change notification settings - Fork 845
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
pass merging object to mixins #926
Conversation
@@ -147,9 +147,9 @@ function write (_obj, msg, num) { | |||
var obj | |||
|
|||
if (_obj === undefined || _obj === null) { | |||
obj = mixin ? mixin() : {} | |||
obj = mixin ? mixin({}) : {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not totally needed, just figured I'd be nice and pass an empty object. 🤷
Will add a test shortly, sorry about that. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This is also missing some docs update |
Yep, was wondering about that, I'll do that. Thanks! |
Took a crack at integrating it to documentation, let me know any feedback. :) |
@@ -124,7 +124,7 @@ const mixin = { | |||
} | |||
|
|||
const logger = pino({ | |||
mixin() { | |||
mixin({ description }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name the paramenter obj
, without destructuring
Restores the original semantics introduced by afb639c (pinojs#857). Reverts the changes to this documentation from 6e50d72 (pinojs#928) and 6c42f14 (pinojs#926).
Restores the original semantics introduced by afb639c (pinojs#857). Reverts the changes to this documentation from 6e50d72 (pinojs#928) and 6c42f14 (pinojs#926). Fixes pinojs#951.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Allows for mixins to take in an object and add information contextually.
For instance, if your
mergingObject
has anerror
key (a JS Error), I want to add{ message: error.message, stack: error.stack }
. This will make mixins more useful or having to pull from higher in the scope.