0.0.1 • Published 11 years ago
instruments v0.0.1
Instruments
Simple function instrumentation
Installation
Clone this repository:
$ git clone git@github.com:rjz/instruments.gitUsage
Use instruments to create function reporting:
var instruments = require('instruments')();
function somethingSlow (callback) {
setTimeout(callback, 5000);
}
var timedSomethingSlow = instruments.timed('timer1', somethingSlow);Specify a custom reporter (Defaults to console.log) when creating the
instruments:
var instruments = require('instruments')({
report: function (entry) {
console.log('[instrument]', entry);
}
});Instruments
counter(name, fn)- increment a counter on each calltimed(name, fn)- elapsed time for an async (continuation-style) functiontimedSync(name, fn)- elapsed time for a blocking function
Testing
Lint:
$ npm lintLint and run test suite:
$ npm testLicense
MIT
0.0.1
11 years ago