Created
September 4, 2013 23:14
-
-
Save jrburke/6444081 to your computer and use it in GitHub Desktop.
Crude tracer
This file contains 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
// Optionally log all calls done to prototype methods. Uncomment this | |
// section to get traces when trying to debug where flow gets stuck. | |
Object.keys(Email.prototype).forEach(function(key) { | |
var desc = Object.getOwnPropertyDescriptor(Email.prototype, key); | |
if (!desc.get && !desc.set && typeof Email.prototype[key] === 'function') { | |
var oldMethod = Email.prototype[key]; | |
Email.prototype[key] = function() { | |
var args = Array.prototype.slice.call(arguments, 0).map(function(arg) { | |
return String(arg); | |
}).join(', '); | |
console.log('Email.' + key + '(' + args + ')'); | |
return oldMethod.apply(this, arguments); | |
}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment