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.
14 lines
358 B
14 lines
358 B
2 years ago
|
'use strict';
|
||
|
const moment = require('moment');
|
||
|
|
||
|
async function factory (ctx, next) {
|
||
|
try {
|
||
|
const start = moment()
|
||
|
await next()
|
||
|
ctx.fs.logger.log(`DurationCalc: ${ctx.path} 用时 ${moment().diff(start, 'milliseconds')}`);
|
||
|
} catch (error) {
|
||
|
ctx.fs.logger.error(`DurationCalc, error: ${error}`);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = factory;
|