Skip to content

Commit 799a39d

Browse files
committed
feat: add request logging
1 parent a232b8f commit 799a39d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/templates/getHandler.ts

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const makeHandler =
6161
bridge.listen()
6262

6363
return async (event, context) => {
64+
const start = Date.now()
6465
let requestMode = mode
6566
// Ensure that paths are encoded - but don't double-encode them
6667
event.path = new URL(event.rawUrl).pathname
@@ -99,6 +100,7 @@ const makeHandler =
99100
multiValueHeaders['cache-control'] = ['public, max-age=0, must-revalidate']
100101
}
101102
multiValueHeaders['x-render-mode'] = [requestMode]
103+
console.log(`[${event.method}: ${requestMode?.toUpperCase()}] ${event.path} (${Date.now() - start}ms)`)
102104
return {
103105
...result,
104106
multiValueHeaders,

0 commit comments

Comments
 (0)