Skip to content

Commit

Permalink
fix: Update the accesslogger and desctruct the correct field
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Oct 13, 2023
1 parent 4c1b2a4 commit 2e174b0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server/middleware/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type AccessLogger = (arg0: ReturnVoid) => ReturnType<Morgan>

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)
Expand All @@ -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,
Expand Down

0 comments on commit 2e174b0

Please sign in to comment.