diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-18 18:35:28 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-18 18:35:28 +0200 |
commit | 5d27fb85fc3d482f10aa7b5fab900beb1d4a0e92 (patch) | |
tree | c7d410e2c8700fdeff9e5b1193a6ec3a341ea1f7 /log.h | |
parent | f64ef1a6c476bcdf6212931a086e263d8d60daeb (diff) | |
download | cpp-utils-5d27fb85fc3d482f10aa7b5fab900beb1d4a0e92.tar.gz cpp-utils-5d27fb85fc3d482f10aa7b5fab900beb1d4a0e92.zip |
log: replace fprintf with fwrite
Diffstat (limited to 'log.h')
-rw-r--r-- | log.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |