1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/middleware/request-logger.js

15 lines
369 B
JavaScript
Raw Normal View History

'use strict';
2017-12-18 15:12:44 +01:00
const url = require('url');
module.exports = function(config) {
const logger = config.getLogger('HTTP');
return (req, res, next) => {
next();
if (config.enableRequestLogger) {
2017-12-18 15:12:44 +01:00
const { pathname } = url.parse(req.originalUrl);
logger.info(`${res.statusCode} ${req.method} ${pathname}`);
}
};
};