@@ -2,8 +2,8 @@ const onFinished = require('on-finished');
22const onHeaders = require ( 'on-headers' ) ;
33
44const expressMiddleware = function ( req , response , next ) {
5- const reqInfo = `${ req . method } ${ req . originalUrl } HTTP/ ${ req . httpVersion } ` ;
6- this . debug ( { req, ackId : req . ackId } , `${ reqInfo } - Request accepted` ) ;
5+ const reqIn = `--- ${ req . method } ${ req . originalUrl } ${ req . headers [ 'user-agent' ] } ` ;
6+ this . debug ( { req, ackId : req . ackId } , `${ reqIn } - Request accepted` ) ;
77 req . _startAt = process . hrtime ( ) ;
88 onHeaders ( response , ( ) => {
99 response . _startAt = process . hrtime ( ) ;
@@ -14,15 +14,16 @@ const expressMiddleware = function(req, response, next) {
1414 } ) ;
1515 onFinished ( response , ( err , res ) => {
1616 const error = res [ Symbol . for ( 'error' ) ] ;
17+ const reqOut = `${ res . statusCode } ${ req . method } ${ req . originalUrl } ${ res . time } ms ${ req . headers [ 'user-agent' ] } ` ;
1718 if ( this . options . ignoredHttpMethods . includes ( req . method ) ) {
1819 return ;
1920 }
2021 if ( error ) {
21- this . error ( { error, req, res, ackId : req . ackId } , `${ reqInfo } - Error handler at the end of app` ) ;
22+ this . error ( { error, req, res, ackId : req . ackId } , `${ reqOut } - Error handler at the end of app` ) ;
2223 } else if ( res . out ) {
23- this . debug ( { req, res, ackId : req . ackId } , `${ reqInfo } - Standard output [ ${ res . statusCode } ] ` ) ;
24+ this . debug ( { req, res, ackId : req . ackId } , `${ reqOut } - Standard output` ) ;
2425 } else {
25- this . info ( { req, res, ackId : req . ackId } , `${ reqInfo } - Standard output [ ${ res . statusCode } ] ` ) ;
26+ this . info ( { req, res, ackId : req . ackId } , `${ reqOut } - Standard output` ) ;
2627 }
2728 } ) ;
2829 next ( ) ;
0 commit comments