aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--log.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/log.h b/log.h
index 8bb53c6..6aca9ea 100644
--- a/log.h
+++ b/log.h
@@ -167,11 +167,11 @@ constexpr void logger<WithTimestamp, BufSize>::log(const char* fmt,
assert(pos < BufSize);
// Ensure terminated with new line and null terminator.
- assert(pos < BufSize - 1);
- m_buf[pos++] = '\0';
+ assert(pos < BufSize);
+ m_buf[pos++] = '\n';
// Write out log message.
- std::fprintf(stderr, "%s\n", m_buf);
+ std::fwrite(m_buf, pos < BufSize ? pos : BufSize, 1 /* nmemb */, stderr);
}
} // namespace logging