Skip to content

Instantly share code, notes, and snippets.

@jsejcksn
Created January 8, 2020 21:35
Show Gist options
  • Save jsejcksn/5aa283cb786805080fd98df06c1f5a24 to your computer and use it in GitHub Desktop.
Save jsejcksn/5aa283cb786805080fd98df06c1f5a24 to your computer and use it in GitHub Desktop.
Use inspect to log deep objects in Node.js
import util from 'util';
const log = (() => {
const log = (...values) => {
console.log(...values.map(value => util.inspect(value, {
colors: true,
depth: null,
getters: true,
showHidden: false,
...log.options,
})));
};
log.options = {};
return log;
})();
export default log;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment