On 02.07.2015 00:16, Andrew Hundt wrote:
I really only need some of the functionality of BOOST_LOG_TRIVIAL, perhaps plus loving to a file in addition to the console. However, my only true need is that all the work (or as much as possible) must be done in a separate thread so as not to slow the current thread down. Right now when I use BOOST_LOG_TRIVIAL as is it causes latency in my network communications which have soft realtime requirements so I've had to comment all of my logs out.
Is there a straightforward non-intrusive solution to having as much of the work as possible for boost.log be done in a separate thread?
Boost.Log does support asynchronous logging[1] although the current implementation might not suit well for realtime use either. It does have a lock in the internal record queue which is used to pass log records from the application threads to the log processing thread, although the critical section is minimal. In order to enable async logging you have to configure the library by adding asynchronous sinks and probably some attributes on your application startup. You can keep using BOOST_LOG_TRIVIAL for emitting log records, the only change needed is the initial configuration. [1] http://www.boost.org/doc/libs/1_58_0/libs/log/doc/html/log/detailed/sink_fro...