Skip to content

Commit

Permalink
feat(middleware): include userId and congregationId in log
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Jan 12, 2025
1 parent c753696 commit dfcd8e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v3/middleware/update_tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export const updateTracker = () => {
origin: req.headers.origin || req.hostname,
ip: clientIp,
details: res.locals.message?.replace(/\n|\r/g, '') || '',
userId: res.locals.currentUser.id,
congregationId: res.locals.currentUser.profile.congregation?.id,
};

logger(res.locals.type, JSON.stringify(log));
Expand All @@ -68,6 +70,8 @@ export const updateTracker = () => {
origin: req.headers.origin || req.hostname,
ip: clientIp,
details: 'this request was aborted',
userId: res.locals.currentUser.id,
congregationId: res.locals.currentUser.profile.congregation?.id,
};

logger('warn', JSON.stringify(log));
Expand Down

0 comments on commit dfcd8e4

Please sign in to comment.