All Projects → feross → call-log

feross / call-log

Licence: MIT license
Instrument a JavaScript class (or object) so that anytime a method function is called it gets logged to the console.

Programming Languages

javascript
184084 projects - #8 most used programming language

call-log travis npm downloads javascript style guide

Instrument a JavaScript class (or object) so that anytime a method function is called it gets logged to the console.

cat

install

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.

usage

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!"

license

MIT. Copyright (c) Feross Aboukhadijeh

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].