restify-logger
A custom logger for restify
Last updated 12 years ago by matthieu.bacconnier .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install restify-logger 
SYNC missed versions from official npm registry.

Restify logger

Visit http://anyfetch.com for details about AnyFetch.

Customizable logger for Restify based on mogan.

Usage

var logger = require('restify-logger');

// You can use the skip parameter to skip some requests
app.use(logger('custom', {
  skip: function (req) {
    return process.env.NODE_ENV === "test" || req.method === "OPTIONS" || req.url === "/status";
  }
}));

This will display:

DELETE ???:/user/542d5154d0db17c03ecd1499 25ms 204

Overriding tokens

You can specify a function to be used by the user token:

// Overwrite the default user function, that only writes '???:'
logger.token('user', function(req) {
  return (req.user && req.user.email || '???') + ':';
});

This will display:

DELETE test@anyfetch.com:/user/542d5154d0db17c03ecd1499 25ms 204

Overriding formats

var logger = require('restify-logger');

// morgan syntax
logger.format('my-simple-format', ':method :url :status')
app.use(logger('my-simple-format'));

This will display:

DELETE /user/542d5154d0db17c03ecd1499 204

Support: support@anyfetch.com.

Current Tags

  • 2.0.1                                ...           latest (12 years ago)

2 Versions

  • 2.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |