-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Logs to user functions in BE (#1568)
* added function to console log attemp/userIP/role; put in getUser, getUserList, updateUserStatus * changed the ipAddress to use events.requestContext.identity.sourceIp * removed the andie console logs
- Loading branch information
1 parent
6696a62
commit 05ac99d
Showing
4 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const logAttempt = (functionName, attemptType, ipAddress, user) => { | ||
const currentTimeStamp = new Date().toISOString(); | ||
ipAddress = ipAddress ?? "Not found"; | ||
const attemptStatus = attemptType ? "success" : "failure"; | ||
const role = user ? user.role : "Not found"; | ||
const message = `attempts ${functionName}: ${attemptStatus} | request timestamp: ${currentTimeStamp} | userRole: ${role} | IP address: ${ipAddress}`; | ||
console.log(message); | ||
}; |