在 Boost.Log 中正确使用 asynchronous_sink::flush()

Properly use asynchronous_sink::flush() in Boost.Log

根据 Boost.Log 文档(参见 this 页末),asynchronous_sinkflush() 方法需要

The sink frontend must be constructed without spawning a dedicated thread.

这个要求对我来说毫无意义。此外,整个 Boost.Log 文档(例如,参见 here and here)中的示例代码都没有满足它。那么,如何正确使用flush()方法呢?

前置条件不正确。当有专门的记录馈送线程时,您可以使用 flush