next/server/middleware/90.log.ts

14 lines
319 B
TypeScript
Raw Normal View History

import { log } from "@server/logger";
export default eventHandler(async (ev) => {
const p = log.startTimer();
ev.node.res.on("close", () => {
p.done({
label: "http/request",
message: `{${
ev.context.currentUser?.username || "guest"
}} | ${ev.method.toLocaleUpperCase()} @ ${ev._path}`,
});
});
});