You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
12:53
trent
then I'd update https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L629-648 to be lazy. I.e. only stringify "obj" when you hit the first stream that isn't "raw".
this would mean checking the stream type for every stream for every log record... which is the hot path. An eventually faster way would be to have the "this._emitRawOnly", "this._emitMixed" and "this._emitNoRaw" methods and set "this._emit" to the appropriate one on Logger creation.
I could do that part tho (because Logger creation is finnicky because of log.child(...))
The text was updated successfully, but these errors were encountered:
"raw" is now a stream "type" isntead of a separate attribute. The
idea is that writing raw objects (instead of JSON-stringified stings)
to, e.g. a file WriteStream isn't useful. So, lets re-use the stream
"type" field instead of an additional "raw" field.
rent
actually I think I'd add a "raw" stream type, which means updating that here: https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L308-329
then update the _emit function here: https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L650-657 to call
s.stream.write(obj)
(instead of writing "str")12:51
orlando@eng.joyent.com
ah you mean rather than raw: true?
12:51
trent
yah
I don't see "raw: true" being useful for things like a "file" stream where the .write() method can only handle a string
12:52
orlando@eng.joyent.com
right
12:53
trent
then I'd update https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L629-648 to be lazy. I.e. only stringify "obj" when you hit the first stream that isn't "raw".
this would mean checking the stream type for every stream for every log record... which is the hot path. An eventually faster way would be to have the "this._emitRawOnly", "this._emitMixed" and "this._emitNoRaw" methods and set "this._emit" to the appropriate one on Logger creation.
I could do that part tho (because Logger creation is finnicky because of
log.child(...)
)The text was updated successfully, but these errors were encountered: