node icon indicating copy to clipboard operation
node copied to clipboard

trace_events: improve readability of example code output

Open umuoy1 opened this issue 1 year ago • 1 comments

improve readability of example code output

umuoy1 avatar Jun 19 '23 07:06 umuoy1

Node.js passes the arguments of console.log() to a formatter which is util.formatWithOptions() that passes objects to util.inspect() which in turn are formatted very well and are much more readable than JSON.stringify().

JSON.stringify() can't serialize everything (such as bigints) and omit things like classes, methods, and anything that can't be represented in a JSON, and also won't contain any colors unlike console.log()'s output, so this change makes it way less readable.

VoltrexKeyva avatar Jun 19 '23 14:06 VoltrexKeyva