我有 25 个解析器,我不想在每个解析器中编写一个记录器,而是想使用某种拦截器来记录每个解析器的时间。我要传入
plugins
如下图:
plugins: [
{
{
requestDidStart: async (args, next) => {
const start = new Date().getTime();
const result = await next();
const end = new Date().getTime();
console.log(`Time of execution for ${args.contextDetails.operationName}: ${end-start}`);
return result;
},
}
}
]