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

A base class for a logging sink frontend with formatting support. More...

#include <basic_sink_frontend.hpp>

Inheritance diagram for boost::sinks::basic_formatting_sink_frontend< CharT >:
Collaboration diagram for boost::sinks::basic_formatting_sink_frontend< CharT >:

Public Types

typedef CharT char_type
 Character type. More...
 
typedef std::basic_string
< char_type
string_type
 Formatted string type. More...
 
typedef basic_formatter
< char_type
formatter_type
 Formatter function object type. More...
 
typedef formatter_type::stream_type stream_type
 Output stream type. More...
 
typedef
base_type::exception_handler_type 
exception_handler_type
 An exception handler type. More...
 

Public Member Functions

 basic_formatting_sink_frontend (bool cross_thread)
 Initializing constructor. More...
 
template<typename FunT >
void set_formatter (FunT const &formatter)
 The method sets sink-specific formatter function object. More...
 
void reset_formatter ()
 The method resets the formatter. More...
 
std::locale getloc () const
 The method returns the current locale used for formatting. More...
 
void imbue (std::locale const &loc)
 The method sets the locale used for formatting. 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...
 
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...
 

Protected Types

typedef base_type::mutex_type mutex_type
 Mutex type. More...
 

Protected Member Functions

formatter_typeformatter ()
 Returns reference to the formatter. 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...
 
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 flush_backend (BackendMutexT &backend_mutex, BackendT &backend)
 Flushes record buffers in the backend, if one supports it. More...
 

Detailed Description

template<typename CharT>
class boost::sinks::basic_formatting_sink_frontend< CharT >

A base class for a logging sink frontend with formatting support.

Member Typedef Documentation

template<typename CharT >
typedef CharT boost::sinks::basic_formatting_sink_frontend< CharT >::char_type

Character type.

Formatter function object type.

template<typename CharT >
typedef base_type::mutex_type boost::sinks::basic_formatting_sink_frontend< CharT >::mutex_type
protected

Mutex type.

Output stream type.

template<typename CharT >
typedef std::basic_string< char_type > boost::sinks::basic_formatting_sink_frontend< CharT >::string_type

Formatted string type.

Constructor & Destructor Documentation

template<typename CharT >
boost::sinks::basic_formatting_sink_frontend< CharT >::basic_formatting_sink_frontend ( bool  cross_thread)
inlineexplicit

Initializing constructor.

Parameters
cross_threadThe flag indicates whether the sink passes log records between different threads

Member Function Documentation

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

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 >.

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 CharT >
template<typename BackendMutexT , typename BackendT >
void boost::sinks::basic_formatting_sink_frontend< CharT >::feed_record ( record_view const &  rec,
BackendMutexT &  backend_mutex,
BackendT &  backend 
)
inlineprotected
virtual void boost::sinks::sink::flush ( )
pure virtualinherited

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 >.

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().

template<typename CharT >
formatter_type& boost::sinks::basic_formatting_sink_frontend< CharT >::formatter ( )
inlineprotected

Returns reference to the formatter.

template<typename CharT >
std::locale boost::sinks::basic_formatting_sink_frontend< CharT >::getloc ( ) const
inline

The method returns the current locale used for formatting.

References boost::lock().

template<typename CharT >
void boost::sinks::basic_formatting_sink_frontend< CharT >::imbue ( std::locale const &  loc)
inline

The method sets the locale used for formatting.

References boost::lock().

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.

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 CharT >
void boost::sinks::basic_formatting_sink_frontend< CharT >::reset_formatter ( )
inline

The method resets the formatter.

References boost::lock().

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 CharT >
template<typename FunT >
void boost::sinks::basic_formatting_sink_frontend< CharT >::set_formatter ( FunT const &  formatter)
inline

The method sets sink-specific formatter function object.

References boost::lock().

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

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 >.

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

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.

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: