You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
462 B

/**
* Create a middleware that prints access logs via pelias-logger.
*/
'use strict';
var morgan = require( 'morgan' );
var through = require( 'through2' );
var peliasLogger = require( 'pelias-logger' ).get( 'api' );
function createAccessLogger( logFormat ){
return morgan( logFormat, {
stream: through( function write( ln, _, next ){
peliasLogger.info( ln.toString().trim() );
next();
})
});
}
module.exports = createAccessLogger;