replaced some console.errors with logger
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const EmailClient = require("../core/EmailClient");
|
||||
const TemplateManager = require("../core/TemplateManager");
|
||||
const logger = require("../../../utils/logger");
|
||||
|
||||
/**
|
||||
* ForumEmailService handles all forum-related email notifications
|
||||
@@ -31,7 +32,7 @@ class ForumEmailService {
|
||||
]);
|
||||
|
||||
this.initialized = true;
|
||||
console.log("Forum Email Service initialized successfully");
|
||||
logger.info("Forum Email Service initialized successfully");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,14 +89,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum comment notification email sent to ${postAuthor.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error("Failed to send forum comment notification email:", error);
|
||||
logger.error("Failed to send forum comment notification email:", error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
}
|
||||
@@ -163,14 +164,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum reply notification email sent to ${commentAuthor.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error("Failed to send forum reply notification email:", error);
|
||||
logger.error("Failed to send forum reply notification email:", error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
}
|
||||
@@ -227,14 +228,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum answer accepted notification email sent to ${commentAuthor.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send forum answer accepted notification email:",
|
||||
error
|
||||
);
|
||||
@@ -301,14 +302,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum thread activity notification email sent to ${participant.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send forum thread activity notification email:",
|
||||
error
|
||||
);
|
||||
@@ -372,14 +373,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum post closed notification email sent to ${recipient.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send forum post closed notification email:",
|
||||
error
|
||||
);
|
||||
@@ -432,14 +433,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum post deletion notification email sent to ${postAuthor.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send forum post deletion notification email:",
|
||||
error
|
||||
);
|
||||
@@ -494,14 +495,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Forum comment deletion notification email sent to ${commentAuthor.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send forum comment deletion notification email:",
|
||||
error
|
||||
);
|
||||
@@ -557,14 +558,14 @@ class ForumEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Item request notification email sent to ${recipient.email}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error("Failed to send item request notification email:", error);
|
||||
logger.error("Failed to send item request notification email:", error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user