Skip to content

Commit

Permalink
add more log cases
Browse files Browse the repository at this point in the history
  • Loading branch information
birdpump committed Aug 11, 2024
1 parent 78aa4bb commit d5387ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion controllers/app/appRegister.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Op} from "sequelize";
import {queryAreaRestriction, queryGradeRestriction} from "../admin/adminData.js";
import {throwApplicationError} from "../../middleware/errorHandler.js";
import {sendLockerEmail} from "../../utils/app/email/sendEmail.js";

import {logger} from "../../utils/admin/logging/logger.js";

export async function registerUserToLocker(data) {
//studentID, building, floor, level
Expand Down Expand Up @@ -111,6 +111,7 @@ export async function registerUserToLocker(data) {
await selectedUser.setLocker(selectedLocker);
}

logger.info(`Locker ${selectedLocker.lockerNumber} successfully assigned to ${students.join(' ')}`)

//send locker email to students
//todo this is disabled for now, lets put this as an admin config toggle from dashboard
Expand Down
4 changes: 2 additions & 2 deletions utils/app/email/sendEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function generateVerificationEmail(link) {
}

export async function sendVerificationEmail(email, link) {
logger.info(`SES Called: ${email}`);
logger.debug(`SES Called: ${email}`);
let htmlContent = await generateVerificationEmail(link);
const params = {
Destination: {
Expand All @@ -45,7 +45,7 @@ export async function sendVerificationEmail(email, link) {
};
try {
let result = await sesClient.send(new SendEmailCommand(params));
logger.info(`SES Sent: ${email} - Code: ${result.$metadata.httpStatusCode} - MsgID: ${result.MessageId}`)
logger.debug(`SES Sent: ${email} - Code: ${result.$metadata.httpStatusCode} - MsgID: ${result.MessageId}`)
} catch (err) {
console.log(`SES Error: ${email}`);
console.log(err);
Expand Down

0 comments on commit d5387ee

Please sign in to comment.