Skip to content

Instantly share code, notes, and snippets.

@peaBerberian
Last active January 22, 2021 09:33
Show Gist options
  • Save peaBerberian/0933d7e5e5eb0294622891445e2436df to your computer and use it in GitHub Desktop.
Save peaBerberian/0933d7e5e5eb0294622891445e2436df to your computer and use it in GitHub Desktop.
{
const cLog = console.log;
const cWarn = console.warn;
const cError = console.error;
const cInfo = console.info;
const cDebug = console.debug;
function addTSToArgumentList(argList) {
const ret = [performance.now()];
for (let i = 0; i < argList.length; i++) {
ret.push(argList[i]);
}
return ret;
}
console.log = function () {
return cLog.apply(console, addTSToArgumentList(arguments));
};
console.warn = function () {
return cWarn.apply(console, addTSToArgumentList(arguments));
};
console.error = function () {
return cError.apply(console, addTSToArgumentList(arguments));
};
console.info = function () {
return cInfo.apply(console, addTSToArgumentList(arguments));
};
console.debug = function () {
return cDebug.apply(console, addTSToArgumentList(arguments));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment