next/server/middleware/90.log.ts

13 lines
288 B
TypeScript

import { log } from "~/lib/server/logger";
export default eventHandler(async (ev) => {
log.profile("request");
ev.node.res.on("close", () => {
log.profile(
`{${
ev.context.currentUser?.username || "guest"
}} | ${ev.method.toLocaleUpperCase()} @ ${ev._path}`,
);
});
});