refactor: enhance logging in auth handler to include detailed response information for better debugging

This commit is contained in:
Rotimi Best
2026-05-20 13:51:23 +01:00
parent f7d6f81901
commit e66a8d8441
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -104,7 +104,18 @@ export const app = new Hono()
const response = await auth.handler(request);
if (response.status >= 300 && response.status < 400) {
console.log('[auth-handler]', c.req.method, c.req.path, '→', response.status, response.headers.get('location'));
const location = response.headers.get('location') ?? '';
const setCookies = response.headers.get('set-cookie') ?? '';
console.log(
'[auth-handler]',
c.req.method,
c.req.path,
'→',
response.status,
`location.length=${location.length}`,
`setCookie.length=${setCookies.length}`,
`location[0..200]=${location.slice(0, 200)}`
);
}
return response;