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");
|
||||
|
||||
/**
|
||||
* CustomerServiceEmailService handles all customer service alert emails
|
||||
@@ -28,7 +29,7 @@ class CustomerServiceEmailService {
|
||||
]);
|
||||
|
||||
this.initialized = true;
|
||||
console.log("Customer Service Email Service initialized successfully");
|
||||
logger.info("Customer Service Email Service initialized successfully");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +60,7 @@ class CustomerServiceEmailService {
|
||||
try {
|
||||
const csEmail = process.env.CUSTOMER_SUPPORT_EMAIL;
|
||||
if (!csEmail) {
|
||||
console.warn("No customer service email configured");
|
||||
logger.warn("No customer service email configured");
|
||||
return { success: false, error: "No customer service email configured" };
|
||||
}
|
||||
|
||||
@@ -92,14 +93,14 @@ class CustomerServiceEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Late return notification sent to customer service for rental ${rental.id}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send late return notification to customer service:",
|
||||
error
|
||||
);
|
||||
@@ -148,7 +149,7 @@ class CustomerServiceEmailService {
|
||||
try {
|
||||
const csEmail = process.env.CUSTOMER_SUPPORT_EMAIL;
|
||||
if (!csEmail) {
|
||||
console.warn("No customer service email configured");
|
||||
logger.warn("No customer service email configured");
|
||||
return { success: false, error: "No customer service email configured" };
|
||||
}
|
||||
|
||||
@@ -206,14 +207,14 @@ class CustomerServiceEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Damage report notification sent to customer service for rental ${rental.id}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send damage report notification to customer service:",
|
||||
error
|
||||
);
|
||||
@@ -248,7 +249,7 @@ class CustomerServiceEmailService {
|
||||
try {
|
||||
const csEmail = process.env.CUSTOMER_SUPPORT_EMAIL;
|
||||
if (!csEmail) {
|
||||
console.warn("No customer service email configured");
|
||||
logger.warn("No customer service email configured");
|
||||
return { success: false, error: "No customer service email configured" };
|
||||
}
|
||||
|
||||
@@ -280,14 +281,14 @@ class CustomerServiceEmailService {
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
console.log(
|
||||
logger.info(
|
||||
`Lost item notification sent to customer service for rental ${rental.id}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to send lost item notification to customer service:",
|
||||
error
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user