Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Logger with console.log and call stack in strict mode
const log = console.log
console.log = function logIt() {
var stack = new Error().stack,
callee = stack.split('\n')[3].slice(7),
tag = '[LOG]';
if (arguments.length > 0) {
tag =, 0)[0]
}, tag, callee)
arguments.length > 1 && log.apply(this, arguments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment