...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::sinks::sink — A base class for a logging sink frontend.
// In header: <boost/log/sinks/sink.hpp> class sink { public: // types typedef unspecified exception_handler_type; // An exception handler type. // construct/copy/destruct explicit sink(bool); sink(sink const &) = delete; sink& operator=(sink const &) = delete; ~sink(); // public member functions bool will_consume(attribute_value_set const &); void consume(record_view const &); bool try_consume(record_view const &); void flush(); bool is_cross_thread() const; };
sink
public member functionsbool will_consume(attribute_value_set const & attributes);
The method returns true
if no filter is set or the attribute values pass the filter
Parameters: |
|
void consume(record_view const & rec);
The method puts logging record to the sink
Parameters: |
|
bool try_consume(record_view const & rec);
The method attempts to put logging record to the sink. The method may be used by the core in order to determine the most efficient order of sinks to feed records to in case of heavy contention. Sink implementations may implement try/backoff logic in order to improve overall logging throughput.
Parameters: |
|
||
Returns: |
|
void flush();
The method performs flushing of any internal buffers that may hold log records. The method may take considerable time to complete and may block both the calling thread and threads attempting to put new records into the sink while this call is in progress.
bool is_cross_thread() const;
The method indicates that the sink passes log records between different threads. This information is needed by the logging core to detach log records from all thread-specific resources before passing it to the sink.