fix(common): Single stdout.write()
call per logging in default Logger
#3350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the issue that in PM2 (at least when running in Windows) the logging lines break at the "stdout.write() border".
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The default
LoggerService
multiple times callsprocess.stdout.write()
per logging line. This seems to confuse the process manager PM2's logging system (the full logging message is split into 2 or more parts).An example screenshot:
![image](https://user-images.githubusercontent.com/388796/68378458-7036c000-014c-11ea-9e5e-1f7065dd66e0.png)
What is the new behavior?
I've refactored
printMessage()
so that it concatenates the logging string first and then callsprocess.stdout.write()
once. Same inprintStackTrace()
.Note that other than this there should be no change of the behavior.
... and this fixes my issue with PM2:
![image](https://user-images.githubusercontent.com/388796/68378486-7cbb1880-014c-11ea-9de8-55e7d8ed1a26.png)
Does this PR introduce a breaking change?
Other information