List of all members.
Public Member Functions
|void||write_period_ms (int period_ms)|
|Sets the write period : on the dedicated thread (in milliseconds). |
|Resumes the writes, after a pause(). |
|Pauses the writes, so that you can manipulate the base object (the formatters/destinations, for instance). |
Keeps locks in the worker threads to a minimum: whenever a message is logged, is put into a queue (this is how long the lock lasts). Then, a dedicated thread reads the queue, and processes the messages (applying formatters and destinations if needed).
on_dedicated_threadas the thread safety:
typedef logger_format_write< default_, default_, writer::threading::on_dedicated_thread > logger_type;
Of if you're using boost::logging::scenario::usage scenarios, specify
speed for the
using namespace boost::logging::scenario::usage; typedef use< ..., ..., ..., logger_::favor::speed> finder;
typedef gather::ostream_like::return_str<> string; // not thread-safe logger< string, write_to_cout> g_l(); // thread-safe, on dedicated thread logger< string, on_dedicated_thread<string,write_to_cout> > g_l();
You should note that a writer is not necessary a logger. It can be a destination, for instance. For example, you might have a destination where writing is time consuming, while writing to the rest of the destinations is very fast. You can choose to write to all but that destination on the current thread, and to that destination on a dedicated thread. (If you want to write to all destinations on a different thread, we can go back to transforming a logger...)
|void boost::logging::writer::on_dedicated_thread< msg_type, base_type >::pause||(||)||
Pauses the writes, so that you can manipulate the base object (the formatters/destinations, for instance).
After this function has been called, you can be sure that the other (dedicated) thread is not writing any messagges. In other words, the other thread is not manipulating the base object (formatters/destinations, for instance), but you can do it.
FIXME allow a timeout as well