ololog icon indicating copy to clipboard operation
ololog copied to clipboard

How to disable stringifying?

Open aksperiod opened this issue 5 years ago • 3 comments

Hey, I love this library, however in some cases I would like to output the javascript object without stringifying. How can this be done? Thanks!

aksperiod avatar Jul 02 '19 21:07 aksperiod

Hmm, not sure what you meant by that. As objects have to be stringified in some way before they could be displayed in text :) You mean, stringify without formatting? Or use a default stringifier (like util.inspect from Node)?

Can you provide an example of what you're trying to get?

xpl avatar Jul 03 '19 10:07 xpl

Currently I am using the library on the client-side to make my console.logs cleaner when I view the browser's javascript console. However, in some cases (i.e. fetchComments().then(console.log)) I am logging large arrays of objects and I prefer to use the default browser functionality where I can click on object properties to expand various sections. Does this make sense? Maybe this is not what the library is meant for?

aksperiod avatar Jul 03 '19 13:07 aksperiod

@aksperiod Yeah, that makes sense, as I thought you were using it with Node.

Currently I don't think it's possible to have objects expandable in browser's console, as internally in the library everything is squashed to text before it gets to console.log, and there might be no easy way to change it in a way that would allow passing the original objects down the pipeline...

I will think on that, as that would be a definitely useful feature (as Chrome's console.log does remarkably good job on rendering objects nowadays) — but I cannot promise that it will be implemented anytime soon.

xpl avatar Jul 03 '19 13:07 xpl