-
Notifications
You must be signed in to change notification settings - Fork 518
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
Can't console.log the object in browser #214
Comments
Is a hack, but I can't find any other way. // Use the log like this:
// BunyanBrowserStream.js
// utils.js
|
Note that you can get objects through raw if you pass then in an object as the first arg, e.g.:
However, I do kind of like the idea of that resulting in this call in the browser:
I'm just not sure how to cleanly do that right now. |
You just need to pass the original msgArgs to the rec object before emitting. That will not require any hacks.
How you get the object later? |
Sorry for the crazy delay here. I fell of maint and am trying to get back (see #335 for details on that). I'd like to clarify what is meant by "object" here. Given this naming:
In my comments above I had been stating that the "fields" object is passed through to as an object to "raw" streams (e.g. the default stream used for a Bunyan Logger in the browser). However, I realize that @totty90 is referring to possible objects in the "msgArgs" array, e.g. Please re-open if I've misunderstood you. |
You are using
rec.msg = format.apply(log, msgArgs);
like this which will convert objects to strings:But in browser I would like to do
console.log(object)
, maybe allow me to get arguments by adding this:The text was updated successfully, but these errors were encountered: