From 2e174b0c7c6bfb5806df6a26bd3bc99dd0f22bcb Mon Sep 17 00:00:00 2001 From: Henri Remonen Date: Fri, 13 Oct 2023 12:54:55 +0300 Subject: [PATCH] fix: Update the accesslogger and desctruct the correct field --- src/server/middleware/access.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/middleware/access.ts b/src/server/middleware/access.ts index af42e280..5234fe00 100644 --- a/src/server/middleware/access.ts +++ b/src/server/middleware/access.ts @@ -11,8 +11,8 @@ type AccessLogger = (arg0: ReturnVoid) => ReturnType const access = morgan as unknown as AccessLogger -const accessLogger = access((tokens, req, res) => { - const { uid } = req.headers +const accessLogger = access((tokens, req: any, res) => { + const { user } = req const method = tokens.method(req, res) const url = tokens.url(req, res) @@ -24,7 +24,10 @@ const accessLogger = access((tokens, req, res) => { const additionalInfo = inProduction ? { - userId: uid, + userId: user.id, + username: user.username, + userIamGroups: user.iamGroups, + userLanguage: user.language, method, url, status,