node
node copied to clipboard
trace_events: improve readability of example code output
improve readability of example code output
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.