Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::sinks::synchronous_sink< SinkBackendT > Class Template Reference

Synchronous logging sink frontend. More...

#include <sync_frontend.hpp>

Inheritance diagram for boost::sinks::synchronous_sink< SinkBackendT >:
Collaboration diagram for boost::sinks::synchronous_sink< SinkBackendT >:

Public Types

typedef SinkBackendT sink_backend_type
 Sink implementation type. More...
 
typedef
boost::log::aux::locking_ptr
< sink_backend_type,
backend_mutex_type
locked_backend_ptr
 A pointer type that locks the backend until it's destroyed. More...
 
typedef
base_type::exception_handler_type 
exception_handler_type
 An exception handler type. More...
 

Public Member Functions

 synchronous_sink ()
 Default constructor. More...
 
 synchronous_sink (shared_ptr< sink_backend_type > const &backend)
 Constructor attaches user-constructed backend instance. More...
 
locked_backend_ptr locked_backend ()
 Locking accessor to the attached backend. More...
 
void consume (record_view const &rec)
 Passes the log record to the backend. More...
 
bool try_consume (record_view const &rec)
 The method attempts to pass logging record to the backend. More...
 
void flush ()
 The method performs flushing of any internal buffers that may hold log records. More...
 
template<typename FunT >
void set_filter (FunT const &filter)
 The method sets sink-specific filter functional object. More...
 
void reset_filter ()
 The method resets the filter. More...
 
template<typename FunT >
void set_exception_handler (FunT const &handler)
 The method sets an exception handler function. More...
 
void reset_exception_handler ()
 The method resets the exception handler function. More...
 
bool will_consume (attribute_value_set const &attrs)
 The method returns true if no filter is set or the attribute values pass the filter. More...
 
bool is_cross_thread () const BOOST_NOEXCEPT
 The method indicates that the sink passes log records between different threads. More...
 

Protected Types

typedef
boost::log::aux::light_rw_mutex 
mutex_type
 Mutex type. More...
 

Protected Member Functions

mutex_typefrontend_mutex () const
 Returns reference to the frontend mutex. More...
 
exception_handler_typeexception_handler ()
 Returns reference to the exception handler. More...
 
exception_handler_type const & exception_handler () const
 Returns reference to the exception handler. More...
 
template<typename BackendMutexT , typename BackendT >
void feed_record (record_view const &rec, BackendMutexT &backend_mutex, BackendT &backend)
 Feeds log record to the backend. More...
 
template<typename BackendMutexT , typename BackendT >
bool try_feed_record (record_view const &rec, BackendMutexT &backend_mutex, BackendT &backend)
 Attempts to feeds log record to the backend, does not block if backend_mutex is locked. More...
 
template<typename BackendMutexT , typename BackendT >
void flush_backend (BackendMutexT &backend_mutex, BackendT &backend)
 Flushes record buffers in the backend, if one supports it. More...
 

Detailed Description

template<typename SinkBackendT>
class boost::sinks::synchronous_sink< SinkBackendT >

Synchronous logging sink frontend.

The sink frontend serializes threads before passing logging records to the backend

Member Typedef Documentation

template<typename SinkBackendT >
typedef boost::log::aux::locking_ptr< sink_backend_type, backend_mutex_type > boost::sinks::synchronous_sink< SinkBackendT >::locked_backend_ptr

A pointer type that locks the backend until it's destroyed.

typedef boost::log::aux::light_rw_mutex boost::sinks::basic_sink_frontend::mutex_type
protectedinherited

Mutex type.

template<typename SinkBackendT >
typedef SinkBackendT boost::sinks::synchronous_sink< SinkBackendT >::sink_backend_type

Sink implementation type.

Constructor & Destructor Documentation

template<typename SinkBackendT >
boost::sinks::synchronous_sink< SinkBackendT >::synchronous_sink ( )
inline

Default constructor.

Constructs the sink backend instance. Requires the backend to be default-constructible.

template<typename SinkBackendT >
boost::sinks::synchronous_sink< SinkBackendT >::synchronous_sink ( shared_ptr< sink_backend_type > const &  backend)
inlineexplicit

Constructor attaches user-constructed backend instance.

Parameters
backendPointer to the backend instance
Precondition
backend is not NULL.

Member Function Documentation

template<typename SinkBackendT >
void boost::sinks::synchronous_sink< SinkBackendT >::consume ( record_view const &  rec)
inlinevirtual

Passes the log record to the backend.

Implements boost::sinks::sink.

References boost::sinks::basic_sink_frontend::feed_record().

exception_handler_type& boost::sinks::basic_sink_frontend::exception_handler ( )
inlineprotectedinherited

Returns reference to the exception handler.

exception_handler_type const& boost::sinks::basic_sink_frontend::exception_handler ( ) const
inlineprotectedinherited

Returns reference to the exception handler.

template<typename BackendMutexT , typename BackendT >
void boost::sinks::basic_sink_frontend::feed_record ( record_view const &  rec,
BackendMutexT &  backend_mutex,
BackendT &  backend 
)
inlineprotectedinherited
template<typename SinkBackendT >
void boost::sinks::synchronous_sink< SinkBackendT >::flush ( )
inlinevirtual

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.

Implements boost::sinks::sink.

References boost::sinks::basic_sink_frontend::flush_backend().

template<typename BackendMutexT , typename BackendT >
void boost::sinks::basic_sink_frontend::flush_backend ( BackendMutexT &  backend_mutex,
BackendT &  backend 
)
inlineprotectedinherited

Flushes record buffers in the backend, if one supports it.

Referenced by boost::sinks::unlocked_sink< SinkBackendT >::flush(), and boost::sinks::synchronous_sink< SinkBackendT >::flush().

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

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.

template<typename SinkBackendT >
locked_backend_ptr boost::sinks::synchronous_sink< SinkBackendT >::locked_backend ( )
inline

Locking accessor to the attached backend.

void boost::sinks::basic_sink_frontend::reset_exception_handler ( )
inlineinherited

The method resets the exception handler function.

References boost::lock().

void boost::sinks::basic_sink_frontend::reset_filter ( )
inlineinherited

The method resets the filter.

References boost::lock(), and boost::filter::reset().

template<typename FunT >
void boost::sinks::basic_sink_frontend::set_exception_handler ( FunT const &  handler)
inlineinherited

The method sets an exception handler function.

References boost::lock().

template<typename FunT >
void boost::sinks::basic_sink_frontend::set_filter ( FunT const &  filter)
inlineinherited

The method sets sink-specific filter functional object.

References boost::lock().

template<typename SinkBackendT >
bool boost::sinks::synchronous_sink< SinkBackendT >::try_consume ( record_view const &  rec)
inlinevirtual

The method attempts to pass logging record to the backend.

Reimplemented from boost::sinks::sink.

References boost::sinks::basic_sink_frontend::try_feed_record().

template<typename BackendMutexT , typename BackendT >
bool boost::sinks::basic_sink_frontend::try_feed_record ( record_view const &  rec,
BackendMutexT &  backend_mutex,
BackendT &  backend 
)
inlineprotectedinherited

Attempts to feeds log record to the backend, does not block if backend_mutex is locked.

References boost::empty(), boost::lock(), boost::unique_lock< Mutex >::owns_lock(), boost::unique_lock< Mutex >::swap(), and boost::try_to_lock.

Referenced by boost::sinks::synchronous_sink< SinkBackendT >::try_consume().

bool boost::sinks::basic_sink_frontend::will_consume ( attribute_value_set const &  attrs)
inlinevirtualinherited

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

Parameters
attrsA set of attribute values of a logging record

Implements boost::sinks::sink.

References boost::lock().


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