This commit is contained in:
2025-11-05 16:26:01 -03:00
parent 488b96dc51
commit 0698cff8cf
76 changed files with 374 additions and 2580 deletions

View File

@@ -0,0 +1,20 @@
import { requestIdContext } from '@/context'
import { type LoaderFunctionArgs } from 'react-router'
export const loggingMiddleware = async (
{ request, context }: LoaderFunctionArgs,
next
) => {
const requestId = crypto.randomUUID()
context.set(requestIdContext, requestId)
console.log(`[${requestId}] ${request.method} ${request.url}`)
const start = performance.now()
const response = await next()
const duration = performance.now() - start
console.log(`[${requestId}] Response ${response.status} (${duration}ms)`)
return response
}