From e20d5b0b05f7a245bef1435977a75d8eaf84e880 Mon Sep 17 00:00:00 2001 From: FORESTIER Fabien <fabien.forestier@soprasteria.com> Date: Fri, 14 Jun 2019 15:30:31 +0200 Subject: [PATCH] Fix uncorrectly used Logger --- src/email/email.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/email/email.service.ts b/src/email/email.service.ts index d295e3f..366b905 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}`, ); -- GitLab