I have a bug when EDGE browser crashs in a big project. I need to log all function calls to console to see what function have been called last. And then debug it.
I tried following code, but it shows only calls throught .call()
or .apply()
, but not if someFunction().
var origApply = Function.prototype.apply;
var origCall = Function.prototype.call;
origApply.apply = origApply;
origCall.apply = origApply;
Function.prototype.toString.apply = origApply;
Array.prototype.slice.apply = origApply;
console.trace.apply = origApply;
function __logCall(t, a, finish) {
var calledFn = Function.prototype.toString.apply(t, []).substr(0, 100);
console.log("Calling", calledFn);
}
Function.prototype.call = function () {
__logCall(this, arguments);
return origCall.apply(this, arguments);
};
Function.prototype.apply = function () {
__logCall(this, arguments);
return origApply.apply(this, arguments);
}
Do you have any ideas?