From d95b81d303192f176a970ee1de5ffd7afd5d475c Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Thu, 13 Mar 2025 15:40:45 -0500 Subject: [PATCH] perf(auth): changed the way logs look in the setRoles --- .../services/auth/controllers/userRoles/setSysAdmin.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/services/auth/controllers/userRoles/setSysAdmin.ts b/server/services/auth/controllers/userRoles/setSysAdmin.ts index 18d42b8..724ad0d 100644 --- a/server/services/auth/controllers/userRoles/setSysAdmin.ts +++ b/server/services/auth/controllers/userRoles/setSysAdmin.ts @@ -4,6 +4,7 @@ import {db} from "../../../../../database/dbclient.js"; import {userRoles} from "../../../../../database/schema/userRoles.js"; import {modules} from "../../../../../database/schema/modules.js"; import {roles} from "../../../../../database/schema/roles.js"; +import {createLog} from "../../../logger/logger.js"; export const setSysAdmin = async (user: any, roleName: any): Promise => { // remove all userRoles to prevent errors @@ -25,9 +26,14 @@ export const setSysAdmin = async (user: any, roleName: any): Promise => { module_id: module[i].module_id, role: roleName, }); - console.log(`${user[0].username} has been granted access to ${module[i].name} with the role ${roleName}`); + createLog( + "info", + user[0].username, + "auth", + `${user[0].username} has been granted access to ${module[i].name} with the role ${roleName}` + ); } catch (error) { - console.log(error); + createLog("info", "lst", "auth", `Error settings user access: ${error}`); } }