connect-metric

Middleware that exposes metric for logging in the context of a user

npm install connect-metric
65 downloads in the last day
234 downloads in the last week
1 239 downloads in the last month

connect-metric Build Status

Middleware that exposes metric for logging in the context of a request

Usage

var app = express()
  , metric = require("connect-metric");

app.use(metric());

app.get("/", function(req, res){
  req.metric("home_page", 1, "views"); // measure=home_page val=1 units=views
});

Options

metric(context, options);

context

The metric logger can inherit context

app.use(metric({foo: "bar"}));

app.get("/", function(req, res){
  req.metric("home_page", 1, "views"); // foo=bar measure=home_page val=1 units=views
});

options

options.request_id

Header name that provides a request id.

npm loves you