Created
April 23, 2021 11:50
-
-
Save Domiii/2cc9be4e6cfd929b79ba13ba07e45d16 to your computer and use it in GitHub Desktop.
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
/* trace console logging */ | |
(function __traceConsole__() { | |
Object.entries(console) | |
.forEach(([name, fn]) => { | |
// console.debug(name); | |
if (!require('lodash/isFunction')(fn)) { | |
return; | |
} | |
console[name] = (...args) => { | |
const stack = new Error().stack.split('\n').join('\n '); | |
fn(...args, `\n[TRACE console.${name}]\n ${stack}\n[/TRACE console.${name}]\n`); | |
}; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment