mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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();
 | |
|     };
 | |
| };
 |