SHARE
TWEET

Untitled

a guest May 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.server.pre((req, res, next) => {
  2.     this.logger.debug(`Start ${req.method} ${req.url}`);
  3.     const requestStart = process.hrtime();
  4.     res.on('finish', () => {
  5.         const [reqTimeS, reqTimeNS] = process.hrtime(requestStart),
  6.         requestDurationMS = (reqTimeS * 1e3 + reqTimeNS / 1e9).toFixed(2);
  7.         this.logger.debug(`End ${req.method} ${req.url} (status=${res.statusCode} duration=${requestDurationMS}ms)`);
  8.     });
  9.     next();
  10. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top