mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
17 lines
430 B
JavaScript
17 lines
430 B
JavaScript
'use strict';
|
|
|
|
const url = require('url');
|
|
|
|
module.exports = function(config) {
|
|
const logger = config.getLogger('HTTP');
|
|
return (req, res, next) => {
|
|
if (config.enableRequestLogger) {
|
|
res.on('finish', () => {
|
|
const { pathname } = url.parse(req.originalUrl);
|
|
logger.info(`${res.statusCode} ${req.method} ${pathname}`);
|
|
});
|
|
}
|
|
next();
|
|
};
|
|
};
|