diff options
author | Alan Pearce | 2024-04-01 19:53:19 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-01 19:53:56 +0200 |
commit | 6cabd370fc9d22e5b15c4627eaf1660ae7cafc33 (patch) | |
tree | 82a1685cce50761795134c77f5149ff1a7e56477 /src/app.ts | |
parent | ed1d0c35da6be9d9aadbdacb38fff36b90742de1 (diff) | |
download | website-6cabd370fc9d22e5b15c4627eaf1660ae7cafc33.tar.lz website-6cabd370fc9d22e5b15c4627eaf1660ae7cafc33.tar.zst website-6cabd370fc9d22e5b15c4627eaf1660ae7cafc33.zip |
Merge redirect information into standard log line
Diffstat (limited to 'src/app.ts')
-rw-r--r-- | src/app.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/app.ts b/src/app.ts index e0fe2e8..1b8bcf7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -129,6 +129,7 @@ export const server = { const pathname = url.pathname.replace(/\/\/+/g, "/"); const endTimer = metrics.requestDuration.startTimer({ path: pathname }); let status; + let newpath; const transaction = Sentry.startTransaction({ name: pathname, op: "http.server", @@ -203,7 +204,7 @@ export const server = { }); } else { if (files.has(pathname + "/")) { - log.info(`Redirecting to: ${pathname + "/"}`); + newpath = pathname + "/"; metrics.requests.inc({ method: request.method, path: pathname, @@ -211,7 +212,7 @@ export const server = { }); return new Response("", { status: status, - headers: { location: pathname + "/" }, + headers: { location: newpath }, }); } metrics.requests.inc({ @@ -249,7 +250,7 @@ export const server = { const seconds = endTimer(); metrics.requestDuration.observe(seconds); transaction.finish(); - console.log(request.method, status, pathname); + console.log(request.method, status, pathname, newpath ? newpath : ""); } }, } satisfies Serve; |