diff --git a/lib/logger/src/format.ts b/lib/logger/src/format.ts index 060e0eff6..ad3e7b4d7 100644 --- a/lib/logger/src/format.ts +++ b/lib/logger/src/format.ts @@ -21,9 +21,12 @@ export const createFormatter = (thisLogger: winston.Logger) => } if (info.process) { labels += `[${styles.dim(info.process)}]` - } else { + } + + if (!info.process) { // simulate the newline present in a normal console.log (which we've - // removed from the Console transport) + // removed from the Console transport to support logging forked + // processes which don't necessarilly flush on a newline) message += '\n' } diff --git a/lib/logger/src/helpers.ts b/lib/logger/src/helpers.ts index 8a0fc42f7..98df24952 100644 --- a/lib/logger/src/helpers.ts +++ b/lib/logger/src/helpers.ts @@ -115,7 +115,9 @@ export function hookFork( readableObjectMode: true, transform: (message, _enc, callback) => { // add the log level and wrap the message for the winston stream to - // consume + // consume. we preserve newlines here as, unlike other cases, this + // logger can be called in the middle of a line depending on when + // the stream is flushed. callback(null, { level, message: stripAnsiReset(message) }) } })