Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/segment-boneyard/request-size-log-middleware
- Owner: segment-boneyard
- Created: 2013-12-11T22:41:26.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-04T19:48:49.000Z (almost 11 years ago)
- Last Synced: 2024-04-09T16:31:14.170Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 3
- Watchers: 39
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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 \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```