The readme shows an example:
log.child({req_id: <unique request id>}, true)
But nowhere in the readme (as far as I can tell) are the arguments for log.child() explained beyond:
to create a new logger with additional bound fields that will be included in its log records
update: I've found the answer, but I will leave this issue open, because I think it deserves documentation.
Yeah, maybe try the TypeScript typings if you really get stuck.
What is the second argument? If you figured it out, maybe submit a PR for the docs?
I'm sorry to say that I forgot ๐ญ
It's been a while.
The second parameter is "simple" flag for child log creation.
In the code: https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L346
@param _childSimple (Boolean) An assertion that the given `_childOptions`
(a) only add fields (no config) and (b) no serialization handling is
required for them. IOW, this is a fast path for frequent child
creation.
The code path that uses this flag is in https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L394, for those who are interested in digging a little bit further.
There is a last reference for this flag effects on https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L739, but it looks like that part of the code is commented out for some reason. A git blame would probably lead to the commit and reason behind that, but I'm not motivated enought about the subject.
๋๋
2018๋
6์ 4์ผ (์) 09:14, diego nunes notifications@github.com๋์ด ์์ฑ:
The second parameter is "simple" flag for child log creation.
In the code:
https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L346@param _childSimple (Boolean) An assertion that the given
_childOptions
(a) only add fields (no config) and (b) no serialization handling is
required for them. IOW, this is a fast path for frequent child
creation.The code path that uses this flag is in
https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L394, for
those who are interested in digging a little bit further.โ
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/trentm/node-bunyan/issues/566#issuecomment-394203990,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvEmwRt1kqfNro82BFm1MmiW-RZqoD1ks5t5HvRgaJpZM4RFDIf
.
Most helpful comment
update: I've found the answer, but I will leave this issue open, because I think it deserves documentation.