From 9ef3009cc2ee428d2346d583ffabb267fe0e736e Mon Sep 17 00:00:00 2001 From: Collin Duncan <3679940+cgduncan7@users.noreply.github.com> Date: Sun, 29 Jan 2023 17:56:19 +0100 Subject: [PATCH] Changing logger to show url and method of route --- src/server/http.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/http.ts b/src/server/http.ts index 419a182..ed3f298 100644 --- a/src/server/http.ts +++ b/src/server/http.ts @@ -10,8 +10,8 @@ const server = http.createServer(async (req, res) => { new Logger('request', v4(), LogLevel.DEBUG), async () => { const logger = asyncLocalStorage.getStore() - logger?.debug('Incoming request') const { url, method } = req + logger?.debug('Incoming request', { url, method }) if ( !url || @@ -19,7 +19,7 @@ const server = http.createServer(async (req, res) => { !/^\/reservations$/.test(url) || method.toLowerCase() !== 'post' ) { - logger?.info('Not found') + logger?.info('Not found', { url, method }) res.writeHead(404, 'Not found') res.end() return