xpl / ololog

A better console.log for the log-driven debugging junkies
https://www.npmjs.com/package/ololog
The Unlicense
215 stars 8 forks source link

How to disable stringifying? #13

Open aksperiod opened 5 years ago

aksperiod commented 5 years ago

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!

xpl commented 5 years ago

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?

aksperiod commented 5 years ago

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?

xpl commented 5 years ago

@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.