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

"raw" stream type #8

Closed
trentm opened this issue Mar 14, 2012 · 1 comment
Closed

"raw" stream type #8

trentm opened this issue Mar 14, 2012 · 1 comment

Comments

@trentm
Copy link
Owner

trentm commented Mar 14, 2012

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(...))

trentm added a commit that referenced this issue Jun 21, 2012
"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.
@trentm
Copy link
Owner Author

trentm commented Jun 22, 2012

This'll be in node-bunyan 0.9.0

@trentm trentm closed this as completed Jun 22, 2012
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