request-size-log-middleware

Log an express request if the request body or response body is too large.

request-size-log-middleware

Log an express request if the request body or response body is too large.

var sizeLog = require('request-size-log-middleware');
var logger = new require('winston').Logger();
 
var app = express();
 
app.configure('production', function () {
  app.use(sizeLog(logger));
});

Return a sizelog middleware with custom thresholds:

{
    "warn": bytes('1mb'), // logger.warn after 1mb 
    "error": bytes('2mb') // logger.error after 2mb 
}
WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|