diff --git a/src/email/email.service.ts b/src/email/email.service.ts index d295e3f3025ead9ec5c6182b62c897580d307bf0..366b90542c8212c6a2287678d77862a42d5059c5 100644 --- a/src/email/email.service.ts +++ b/src/email/email.service.ts @@ -112,7 +112,7 @@ export class EmailService { try { conn = await amqp.connect(rabbitmqUrl); } catch (error) { - Logger.error('Error connecting to RabbitMQ', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('Error connecting to RabbitMQ', error, `${EmailService.name} - ${this.send.name}`); throw new InternalServerErrorException('Could not connect to rabbitMQ.'); } @@ -120,7 +120,7 @@ export class EmailService { // Create a communication channel ch = await conn.createChannel(); } catch (error) { - Logger.error('Error creating channel', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('Error creating channel', error, `${EmailService.name} - ${this.send.name}`); throw new InternalServerErrorException('Could not create channel.'); } @@ -130,18 +130,18 @@ export class EmailService { try { await ch.assertQueue(mailerQueue, { durable: true }); } catch (error) { - Logger.error('Error asserting queue', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('Error asserting queue', error, `${EmailService.name} - ${this.send.name}`); throw new InternalServerErrorException('Could not assert queue.'); } try { await ch.sendToQueue(mailerQueue, buffer, { persistent: true }); } catch (error) { - Logger.error('Error sending to queue', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('Error sending to queue', error, `${EmailService.name} - ${this.send.name}`); throw new InternalServerErrorException('Could not send to queue.'); } - Logger.log( + this.logger.log( `Sent to queue ${mailerQueue},{ from: ${email.from}, to: ${email.to}, subject: ${email.subject}}`, `${EmailService.name} - ${this.send.name}`, );