Renamed and improved the synchronous log flushing function.