Created
November 4, 2018 04:55
-
-
Save notacouch/6753042c634a5f9483d488d3657f0d7f to your computer and use it in GitHub Desktop.
life hack: console log function that auto-indents based on the depth of your call stack
This file contains 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
function log(message) { | |
console.log(' '.repeat(new Error().stack.match(/\n/g).length - 2) + message); | |
} |
More:
console.group proof of concept
https://twitter.com/zzzzBov/status/1058457395029008387
https://codepen.io/zzzzBov/pen/yQLyyG/
Supposedly console.trace should help here, too?
https://twitter.com/nrtelang/status/1058530009554579456
https://developers.google.com/web/tools/chrome-devtools/console/console-reference#trace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://twitter.com/sophiebits/status/1058448900460138497