Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/segment-boneyard/request-size-log-middleware

Log an express request if the request body or response body is too large.
https://github.com/segment-boneyard/request-size-log-middleware

Last synced: about 7 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

# request-size-log-middleware

Log an [express](https://github.com/visionmedia/express) request if the request body or response body is too large.

## Example

```js
var sizeLog = require('request-size-log-middleware');
var logger = new require('winston').Logger();

var app = express();

app.configure('production', function () {
app.use(sizeLog(logger));
});
```

## API

### sizeLog(logger, thresholds)

Return a sizelog middleware with custom `thresholds`:

```js
{
"warn": bytes('1mb'), // logger.warn after 1mb
"error": bytes('2mb') // logger.error after 2mb
}
```

## License

```
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```