On Tue, Oct 24, 2017 at 6:12 PM, J Decker <d3c...@gmail.com> wrote: > > On Tuesday, October 24, 2017 at 7:35:20 AM UTC-7, Ben Noordhuis wrote: >> >> On Tue, Oct 24, 2017 at 3:27 PM, J Decker <d3c...@gmail.com> wrote: >> > Is there a way to make a C++ class that has set accessors on the >> > prototype >> > to get its data logged? >> > >> > so like >> > var color = new Color( "white" ); >> > console.log( color ): >> >> I think you are asking about the difference between >> PropertyCallbackInfo<T>::This() and PropertyCallbackInfo<T>::Holder(). >> The first is the instance object, the second the prototype object. >> >> (If it's not that, please clarify what "gets its data logged" means.) > > > No... I'm just asking if there's a way to get console.log to log > setters/getters configured on the object, similar to how it will log > properties directly on an object. > and re the this/holder differneces... the documentation in v8.h describes > this and holder pretty well now.... > >> >> >> > Also, I added a toString() method to the prototype, but apparently I >> > have to >> > append it to a string (as in console.log( ""+color ) } or call it >> > explicitly... console.log( color.toString() ) >> >> Yes. Did you expect something else? > > > Well another thread said I shouldn't have to append it to a string... I > mean doesn't console.log attempt to convert arguments to string anyway? I > know it doesn't in a browser, because you get an arrow you can use to expand > an object... but this is using node... hmm maybe it's more of a node issue; > I suppose if I were using electron or nwjs I would get the object logged > with an expansion arrow...
Right. Yes, the console.log() in Node.js goes well beyond simple stringification. It also doesn't print non-enumerable properties[0] or properties from the prototype chain. [0] `console.log(util.inspect(obj, {showHidden: true}))` will, though. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.