pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.07k stars 2.11k forks source link

Consolidate LogFile implementation to use FileOutputStream #4431

Open matejk opened 5 months ago

matejk commented 5 months ago

LogFile has different implementations for Windows using Win32 API and STD for other platforms where Poco::FileOutputStream is used. Poco::FileOutputStream has Windows and Posix implementations.

LogFile calls FlushFileBuffers on Windows which forcefully flushes buffers to disk. Posix equivalent would be fsync.

Related: #2443, #4429.

matejk commented 5 months ago

Logically, there should be only LogFile, because we have POSIX and WIN32 FileStream; performance may be the reason for the current state.

Some benchmarking would help to make the right decision, ie. whether it makes sense to introduce LogFile_POSIX, instead of having just one LogFile.

As for flush/sync, those should be two separate properties and they should have strategies with reasonable defaults.