2
0
Files

12 lines
343 B
TypeScript
Raw Permalink Normal View History

2024-08-09 00:39:27 +02:00
import { middleware } from "../trpc";
const perfMiddleware = middleware(async ({ path, type, next }) => {
performance.mark("Start");
const result = await next();
performance.mark("End");
performance.measure(`[${result.ok ? "OK" : "ERROR"}][$1] ${type} '${path}'`, "Start", "End");
return result;
});
export default perfMiddleware;