rolled back my clever map+join, because it broke the tests
This commit is contained in:
parent
11fe5bde5f
commit
dd25d30228
@ -26,26 +26,26 @@ function smtpAppender(config, layout) {
|
|||||||
|
|
||||||
var transport = mailer.createTransport(config.transport, config[config.transport]);
|
var transport = mailer.createTransport(config.transport, config[config.transport]);
|
||||||
var firstEvent = logEventBuffer[0];
|
var firstEvent = logEventBuffer[0];
|
||||||
var body = logEventBuffer.map(layout).join('\n');
|
var body = "";
|
||||||
|
while (logEventBuffer.length > 0) {
|
||||||
|
body += layout(logEventBuffer.shift()) + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
var msg = {
|
var msg = {
|
||||||
to: config.recipients,
|
to: config.recipients,
|
||||||
subject: config.subject || subjectLayout(firstEvent),
|
subject: config.subject || subjectLayout(firstEvent),
|
||||||
text: body,
|
text: body,
|
||||||
headers: { "Hostname": os.hostname() }
|
headers: { "Hostname": os.hostname() }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config.sender) {
|
if (config.sender) {
|
||||||
msg.from = config.sender;
|
msg.from = config.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
transport.sendMail(msg, function(error, success) {
|
transport.sendMail(msg, function(error, success) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("log4js.smtpAppender - Error happened", error);
|
console.error("log4js.smtpAppender - Error happened", error);
|
||||||
}
|
}
|
||||||
transport.close();
|
transport.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
logEventBuffer = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user