Skip to content

Commit

Permalink
docs(logger): improve documentation of whitespace handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ivomurrell committed May 20, 2024
1 parent 1ebd75a commit 1ab26ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/logger/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
4 changes: 3 additions & 1 deletion lib/logger/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
})
Expand Down

0 comments on commit 1ab26ea

Please sign in to comment.