fix(logging): updated entire server side to the new logging system

This commit is contained in:
2025-03-07 13:40:29 -06:00
parent ce11b1f57e
commit 12e15babb4
33 changed files with 482 additions and 72 deletions

View File

@@ -5,7 +5,7 @@
import {db} from "../../../../database/dbclient.js";
import {roles} from "../../../../database/schema/roles.js";
import {log} from "../../logger/logger.js";
import {createLog} from "../../logger/logger.js";
// "view", "technician", "supervisor","manager", "admin", "systemAdmin"
const newRoles = [
{name: "viewer"},
@@ -27,12 +27,17 @@ export const areRolesIn = async () => {
.values(newRoles)
.onConflictDoNothing() // this will only update the ones that are new :D
.returning({name: roles.name});
log.info(newRole, "Roles were just added due to missing them on server startup");
createLog(
"info",
"lst",
"auth",
`${JSON.stringify(newRole)}, "Roles were just added due to missing them on server startup"`
);
} catch (error) {
log.error(error, "There was an error adding new roles to the db");
createLog("error", "lst", "auth", "There was an error adding new roles to the db");
}
}
} catch (error) {
log.error(error, "There was an error getting or adding new roles");
createLog("error", "lst", "auth", "There was an error getting or adding new roles");
}
};