From 99be3654b1a0b94c0c73bff1c77922e37fceb38f Mon Sep 17 00:00:00 2001 From: scc Date: Mon, 20 Feb 2023 23:17:31 +0800 Subject: [PATCH] Use fflush at all operating system --- include/spdlog/sinks/stdout_sinks-inl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/spdlog/sinks/stdout_sinks-inl.h b/include/spdlog/sinks/stdout_sinks-inl.h index f8ad947c..8c47de16 100644 --- a/include/spdlog/sinks/stdout_sinks-inl.h +++ b/include/spdlog/sinks/stdout_sinks-inl.h @@ -68,14 +68,13 @@ SPDLOG_INLINE void stdout_sink_base::log(const details::log_msg &m { throw_spdlog_ex("stdout_sink_base: WriteFile() failed. GetLastError(): " + std::to_string(::GetLastError())); } - FlushFileBuffers(handle_); // flush every line to terminal #else std::lock_guard lock(mutex_); memory_buf_t formatted; formatter_->format(msg, formatted); ::fwrite(formatted.data(), sizeof(char), formatted.size(), file_); - ::fflush(file_); // flush every line to terminal #endif // WIN32 + ::fflush(file_); // flush every line to terminal } template