Fixed message logging

Due to the status flags the sequence of log messages could look
broken because of missing newlines at the end of a log message.
This patch checks if a newline is required for the previos message
when the next message is on the way