https://github.com/feross/call-log
Instrument a JavaScript class (or object) so that anytime a method function is called it gets logged to the console.
https://github.com/feross/call-log
Last synced: 4 months ago
JSON representation
Instrument a JavaScript class (or object) so that anytime a method function is called it gets logged to the console.
- Host: GitHub
- URL: https://github.com/feross/call-log
- Owner: feross
- License: mit
- Created: 2013-11-07T06:38:06.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-27T03:44:51.000Z (about 5 years ago)
- Last Synced: 2025-01-03T02:53:09.341Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 66.4 KB
- Stars: 35
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# call-log [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/call-log/master.svg
[travis-url]: https://travis-ci.org/feross/call-log
[npm-image]: https://img.shields.io/npm/v/call-log.svg
[npm-url]: https://npmjs.org/package/call-log
[downloads-image]: https://img.shields.io/npm/dm/call-log.svg
[downloads-url]: https://npmjs.org/package/call-log
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Instrument a JavaScript class (or object) so that anytime a method function is called it gets logged to the console.

## install
```
npm install call-log
```
This module works in the browser with [browserify](http://browserify.org/).
**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
```js
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](http://feross.org)