Skip to content

Commit

Permalink
ref: improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian4res committed Nov 4, 2024
1 parent 6a15aaa commit 65e70da
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/routes/blaiseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function blaiseApi(config: CustomConfig, auth: Auth, blaiseApiCli
auditLogger.error(req.log, "No user provided for deletion");
return res.status(400).json();
}
auditLogger.info(req.log, `${currentUser.name || "Unknown"} has successfully deleted user, ${user}`);
auditLogger.info(req.log, `${currentUser.name || "Unknown"} has successfully deleted user called ${user}`);
return res.status(204).json(await blaiseApiClient.deleteUser(user));
} catch (error) {
auditLogger.error(req.log, `Error whilst trying to delete user, ${req.headers.user}, with error message: ${error}`);
Expand Down
2 changes: 1 addition & 1 deletion server/tests/routes/blaiseApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describe("DELETE /api/users endpoint", () => {
.set("user", username);

const log = logInfo.mock.calls[0][0];
expect(log).toEqual(`AUDIT_LOG: ${mockUser.name} has successfully deleted user, ${username}`);
expect(log).toEqual(`AUDIT_LOG: ${mockUser.name} has successfully deleted user called ${username}`);
expect(response.statusCode).toEqual(204);
blaiseApiMock.verify(a => a.deleteUser(It.isValue<string>(username)), Times.once());
});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/users/UserProfileEdits/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function ChangePassword(): ReactElement {
currentUser,
updatedPanel: {
visible: true,
message: "Password for user " + viewedUsername + " changed at " + (new Date()).toLocaleTimeString("en-UK") + " " + (new Date()).toLocaleDateString("en-UK"),
message: "Password for user " + viewedUsername,
status: "success"
}
}}
Expand Down

0 comments on commit 65e70da

Please sign in to comment.