Note: This project has been moved here https://github.com/Prasanna-sr/Audit-Logger
Provides instrumentation for express or connect middleware specific node.js applications. It helps to capture time taken for each middleware and routes.
When running in production, you may wish you could have certain data avaialble for certain request. It is not efficient to log all parameters for all requests. This library helps you to create application specific rules and provides all application data only when the application fails certain rules.
$ npm install Instrumentation
Initialize your application by requiring the module and calling the constructor with the application object. The timers are made avaialble through req.timers, which can be grabbed anytime during the request period. req.timers is an array containing response time for all your middelwares and routes.
var express = require('express');
var app = express();
var instrumentation = require('instrumentation');
instrumentation(app);
app.use(function prkApp(req, res, next) {
setTimeout(function() {
next();
}, 250);
});
app.get('/apptest', function(req, res, next) {
res.send('apptest');
next();
});
app.use(function prkApp2(req, res, next) {
console.log(req.timers);
});
app.listen(3000);
Examples are avaialbe here
$ npm install
$ npm test