From 49d3a08eb86ee5361f8000286c16d2c96be43dc7 Mon Sep 17 00:00:00 2001 From: Charley Pons <48423735+CharleyPONS@users.noreply.github.com> Date: Fri, 15 Jan 2021 07:05:12 +0100 Subject: [PATCH] fix(smtpappender): call directly layout to avoid lost this context (#55) Co-authored-by: Charley PONS --- packages/smtp/src/SmtpAppender.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/smtp/src/SmtpAppender.ts b/packages/smtp/src/SmtpAppender.ts index aebf438c..8b7d660f 100644 --- a/packages/smtp/src/SmtpAppender.ts +++ b/packages/smtp/src/SmtpAppender.ts @@ -88,14 +88,14 @@ export class SmtpAppender extends BaseAppender { } protected sendBuffer() { - const {config, logEventBuffer, layout, subjectLayout, transport} = this; + const {config, logEventBuffer, subjectLayout, transport} = this; if (logEventBuffer.length > 0) { const firstEvent = logEventBuffer[0]; let body = ""; const count = logEventBuffer.length; while (logEventBuffer.length > 0) { - body += `${layout(logEventBuffer.shift(), config.timezoneOffset)}\n`; + body += `${this.layout(logEventBuffer.shift(), config.timezoneOffset)}\n`; } const msg: any = {