From 30729a0cf707d9022bae0a7baaba77379dc31fd5 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Sun, 11 May 2025 16:20:45 -0700 Subject: Use closure over trace id instead of initializing it every log line. Fix laminar ownership :( --- hooks/mod.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hooks/mod.ts') diff --git a/hooks/mod.ts b/hooks/mod.ts index 8771bea..f858ad0 100755 --- a/hooks/mod.ts +++ b/hooks/mod.ts @@ -9,10 +9,11 @@ import { const getRequestLogger = (req: Request) => { const url = new URL(req.url); + const traceId = crypto.randomUUID(); const getPrefix = () => `[${ new Date().toISOString() - }] RequestTrace=[${crypto.randomUUID()}] @ [${url.pathname}] -X [${req.method}] |`; + }] RequestTrace=[${traceId}] @ [${url.pathname}] -X [${req.method}] |`; return loggerWithPrefix(getPrefix); }; -- cgit v1.2.3-70-g09d2