Skip to content

Commit

Permalink
feat: Improved logs (#188)
Browse files Browse the repository at this point in the history
* feat: Improved logs

* no message
  • Loading branch information
mamartinezmejia authored Nov 21, 2023
1 parent cc710c6 commit c095cb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions backend/src/form/entities/emailSubmissionLog.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface EmailSubmissionLog {
id?: number;
code?: string;
exceptionLog?: string;
confirmationId?: string;
Expand Down
8 changes: 6 additions & 2 deletions backend/src/form/services/form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export class FormService {

// note: everytime change the cronjob interval, need to adjust the interval below that checks new submissions
private interval = 10;
@Cron('*/10 * * * *') //Runs every 10 minutes
//@Cron('*/10 * * * *') //Runs every 10 minutes
// @Cron('*/1 * * * *') //Runs every 1 minutes
// @Cron('45 * * * * *') // Run every 45 seconds
// @Cron('*/5 * * * * *') //Runs every 5 seconds
@Cron('*/5 * * * * *') //Runs every 5 seconds
handleIDIRForm(emailTo: string) {
this.logger.debug('called every 10 mins for idir form');
const formId = process.env.IDIR_FORM_ID;
Expand Down Expand Up @@ -320,6 +320,9 @@ export class FormService {
) {
text = 'updated';
}
console.log(formId, 'Submission Data: ', JSON.stringify(eachSubmission.submission.data));
console.log(formId, 'emailTo: ', emailTo);
console.log(formId, 'emailDistrict: ', emailDistrict);
console.log(formId, 'mail to:', emailSendTo);
const email: EmailEntity = {
emailTo: [emailSendTo],
Expand Down Expand Up @@ -363,6 +366,7 @@ export class FormService {
this.logger.error(
`${formId}: Failed to send email, error logged in db`,
);
console.log("Log ID: " + emailSubmissionLogEntity.id + "\n");
return new HttpException(
{ message: err },
HttpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit c095cb5

Please sign in to comment.