Index: src/log-utils.cc |
diff --git a/src/log-utils.cc b/src/log-utils.cc |
index 8f012252fce9d9252eefe64c677da132de71cf9a..4149186d56968ffea07f66767d5f030394cee047 100644 |
--- a/src/log-utils.cc |
+++ b/src/log-utils.cc |
@@ -219,6 +219,10 @@ void Log::MessageBuilder::AppendStringPart(const char* str, int len) { |
void Log::MessageBuilder::WriteToLogFile() { |
ASSERT(pos_ <= Log::kMessageBufferSize); |
+ // Assert that we do not already have a new line at the end. |
+ ASSERT(pos_ == 0 || log_->message_buffer_[pos_ - 1] != '\n'); |
+ if (pos_ == Log::kMessageBufferSize) pos_--; |
+ log_->message_buffer_[pos_++] = '\n'; |
const int written = log_->WriteToFile(log_->message_buffer_, pos_); |
if (written != pos_) { |
log_->stop(); |