call-log

Instrument an object or class so that anytime one of its method is invoked it gets logged to the console.

call-log

npm install call-log

This module works in the browser with browserify.

Note: If you're NOT using browserify, then use the included standalone file call-log.min.js. This exports a CallLog constructor on window.

var callLog = require('call-log')
 
function Cat () {}
Cat.prototype.meow = function (sound) { return sound }
 
// Add instrumentation to Cat 
callLog(Cat)
 
// Use the cat 
var cat = new Cat()
cat.meow()
cat.meow('MEOAAAAWWW!')
 
// Prints: 
// "called meow" 
// "called meow", "MEOAAAAWWW!" 
 

MIT. Copyright (c) Feross Aboukhadijeh