Created
January 8, 2020 21:35
-
-
Save jsejcksn/5aa283cb786805080fd98df06c1f5a24 to your computer and use it in GitHub Desktop.
Use inspect to log deep objects in Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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