lib/middleware/logRequestTime.js
function logRequest(err, res) {
    if (res) {
      let ms = new Date() - res.requestStartTime;

      var time = ms < 1000 ? `${ms}ms` : `${(ms/1000).toFixed(2)}s`;

      logRoute(`${res.req.method} ${res.statusCode} (${time}): ${res.req.originalUrl}`);
    }
  }
function logRequest(err, res) {
    if (res) {
      let ms = new Date() - res.requestStartTime;

      var time = ms < 1000 ? `${ms}ms` : `${(ms/1000).toFixed(2)}s`;

      logRoute(`${res.req.method} ${res.statusCode} (${time}): ${res.req.originalUrl}`);
    }
  }
function logRequest ( err , res ) { if ( res ) { let ms = new Date ( ) - res . requestStartTime ; var time = ms < 1000 ? ` ${ ms } ` : ` ${ ( ms / 1000 ) . toFixed ( 2 ) } ` ; logRoute ( ` ${ res . req . method } ${ res . statusCode } ${ time } ${ res . req . originalUrl } ` ) ; } }
Log the request time when finished

@param {null|Error} err - Request error if there was one
@param {Request} req - Request Object
Log the request time when finished