As I interact with my AJAX based application at RUNTIME I\'d like the console to spit out all the functions it\'s calling. (so no stack trace, or breakpoints, or pr
I've used @Briguy37's solution with an improvement. In my case, I did not want to trace functions from some libraries, so I added some code to exclude them. Here is how it is used:
Example:
Here is the code I added to @Briguy37's solution:
var excludedFunctions = {};
functionLogger.excludeLoggingToNamespace = function(namespaceObject){
for(var name in namespaceObject){
var potentialFunction = namespaceObject[name];
if(Object.prototype.toString.call(potentialFunction) === '[object Function]') {
excludedFunctions[name] = name;
}
}
};
And I had to modify @Briguy37's addLoggingToNamespace method to take into accound the excludedFunctions hash:
functionLogger.addLoggingToNamespace = function(namespaceObject){
for(var name in namespaceObject){
var potentialFunction = namespaceObject[name];
if(Object.prototype.toString.call(potentialFunction) === '[object Function]' &&
!excludedFunctions[name]) {
namespaceObject[name] = functionLogger.getLoggableFunction(potentialFunction, name);
}
}
};