fix(logHandler): stringify objects instead of trying to split it

This commit is contained in:
Jonathan Rainville 2018-12-19 10:40:42 -05:00
parent 1a4b0aaf07
commit 33d6e29286
1 changed files with 7 additions and 3 deletions

View File

@ -55,9 +55,13 @@ class LogHandler {
processedMessages = [msg.message]; processedMessages = [msg.message];
} else if (Array.isArray(msg.message)) { } else if (Array.isArray(msg.message)) {
msg.message.forEach(message => { msg.message.forEach(message => {
if (Array.isArray(message)) message = message.join('\n'); if (Array.isArray(message)) {
let lines = message.split("\n"); return message.forEach(line => processedMessages.push(line));
lines.forEach(line => processedMessages.push(line)); }
if (typeof message === 'object') {
return processedMessages.push(JSON.stringify(msg.message));
}
message.toString().split("\n").forEach(line => processedMessages.push(line));
}); });
} else if (typeof msg.message === 'object') { } else if (typeof msg.message === 'object') {
processedMessages.push(JSON.stringify(msg.message)); processedMessages.push(JSON.stringify(msg.message));