Open demurgos opened 6 years ago
Just noting that console.log
does not use toString
to format its output, e.g.
console.log({ foo: 'bar', toString: () => 'nice text' });
outputs
{ foo: 'bar', toString: () => 'nice text' }
If the goal is to change the output of console.log
, as the ticket description implies, one has to use util.inspect.custom
:
const util = require('util');
console.log({ foo: 'bar', [util.inspect.custom]: () => 'nice text' });
outputs:
nice text
Regardless, it would be nice to remove some unnecessary information from the output of toString
, like domainEmitter [object Object]
.
@fasttime We already made attempts to improve this in https://github.com/gulpjs/plugin-error/commit/932946a72ed8911aaa362ce09ef9d14931a97542 - if we missed a property, I'm happy to add it to the list of exclusions and release as a bug fix. Want to PR?
@phated Okay, I made a PR: #26.
Imported from https://github.com/gulpjs/gulp-util/issues/74.
/cc @sindresorhus @contra