Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::sinks::sink Class Referenceabstract

A base class for a logging sink frontend. More...

#include <sink.hpp>

Inheritance diagram for boost::sinks::sink:

Public Types

typedef
boost::log::aux::light_function
< void() > 
exception_handler_type
 An exception handler type. More...
 

Public Member Functions

 sink (bool cross_thread)
 Default constructor. More...
 
virtual ~sink ()
 Virtual destructor. More...
 
virtual bool will_consume (attribute_value_set const &attributes)=0
 The method returns true if no filter is set or the attribute values pass the filter. More...
 
virtual void consume (record_view const &rec)=0
 The method puts logging record to the sink. More...
 
virtual bool try_consume (record_view const &rec)
 The method attempts to put logging record to the sink. More...
 
virtual void flush ()=0
 The method performs flushing of any internal buffers that may hold log records. More...
 
bool is_cross_thread () const BOOST_NOEXCEPT
 The method indicates that the sink passes log records between different threads. More...
 

Detailed Description

A base class for a logging sink frontend.

Member Typedef Documentation

typedef boost::log::aux::light_function< void () > boost::sinks::sink::exception_handler_type

An exception handler type.

Constructor & Destructor Documentation

boost::sinks::sink::sink ( bool  cross_thread)
inlineexplicit

Default constructor.

virtual boost::sinks::sink::~sink ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

virtual void boost::sinks::sink::consume ( record_view const &  rec)
pure virtual

The method puts logging record to the sink.

Parameters
recLogging record to consume

Implemented in boost::sinks::asynchronous_sink< SinkBackendT, QueueingStrategyT >, boost::sinks::synchronous_sink< SinkBackendT >, and boost::sinks::unlocked_sink< SinkBackendT >.

virtual void boost::sinks::sink::flush ( )
pure virtual

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.

Implemented in boost::sinks::asynchronous_sink< SinkBackendT, QueueingStrategyT >, boost::sinks::synchronous_sink< SinkBackendT >, and boost::sinks::unlocked_sink< SinkBackendT >.

bool boost::sinks::sink::is_cross_thread ( ) const
inline

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.

virtual bool boost::sinks::sink::try_consume ( record_view const &  rec)
inlinevirtual

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
recLogging record to consume
Returns
true, if the record was consumed, false, if not.

Reimplemented in boost::sinks::asynchronous_sink< SinkBackendT, QueueingStrategyT >, and boost::sinks::synchronous_sink< SinkBackendT >.

virtual bool boost::sinks::sink::will_consume ( attribute_value_set const &  attributes)
pure virtual

The method returns true if no filter is set or the attribute values pass the filter.

Parameters
attributesA set of attribute values of a logging record

Implemented in boost::sinks::basic_sink_frontend.


The documentation for this class was generated from the following file: