Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT > Class Template Reference

A composite logger that inherits a number of features. More...

#include <basic_logger.hpp>

Inheritance diagram for boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >:
Collaboration diagram for boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >:

Public Types

typedef base_type::threading_model threading_model
 Threading model being used. More...
 

Public Member Functions

 basic_composite_logger ()
 Default constructor (default-constructs all features) More...
 
 basic_composite_logger (basic_composite_logger const &that)
 Copy constructor. More...
 
 basic_composite_logger (BOOST_RV_REF(logger_base) that)
 Move constructor. More...
 
template<typename ArgsT >
 basic_composite_logger (ArgsT const &args)
 Constructor with named parameters. More...
 
std::pair
< attribute_set::iterator,
bool > 
add_attribute (attribute_name const &name, attribute const &attr)
 The method adds an attribute to the source-specific attribute set. More...
 
void remove_attribute (attribute_set::iterator it)
 The method removes an attribute from the source-specific attribute set. More...
 
void remove_all_attributes ()
 The method removes all attributes from the logger. More...
 
attribute_set get_attributes () const
 The method retrieves a copy of a set with all attributes from the logger. More...
 
void set_attributes (attribute_set const &attrs)
 The method installs the whole attribute set into the logger. More...
 
record open_record ()
 The method opens a new log record in the logging core. More...
 
template<typename ArgsT >
record open_record (ArgsT const &args)
 The method opens a new log record in the logging core. More...
 
void push_record (BOOST_RV_REF(record) rec)
 The method pushes the constructed message to the logging core. More...
 
void swap (basic_composite_logger &that)
 Thread-safe implementation of swap. More...
 

Protected Types

typedef basic_composite_logger logger_base
 The composite logger type (for use in the user's logger class) More...
 

Protected Member Functions

FinalT & assign (FinalT const &that)
 Assignment for the final class. More...
 

Detailed Description

template<typename CharT, typename FinalT, typename ThreadingModelT, typename FeaturesT>
class boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >

A composite logger that inherits a number of features.

The composite logger is a helper class that simplifies feature composition into the final logger. The user's logger class is expected to derive from the composite logger class, instantiated with the character type, the user's logger class, the threading model and the list of the required features. The former three parameters are passed to the basic_logger class template. The feature list must be an MPL type sequence, where each element is a unary MPL metafunction class, that upon applying on its argument results in a logging feature class that derives from the argument. Every logger feature provided by the library can participate in the feature list.

Member Typedef Documentation

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
typedef basic_composite_logger boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::logger_base
protected

The composite logger type (for use in the user's logger class)

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
typedef base_type::threading_model boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::threading_model

Threading model being used.

Constructor & Destructor Documentation

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::basic_composite_logger ( )
inline

Default constructor (default-constructs all features)

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::basic_composite_logger ( basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT > const &  that)
inline

Copy constructor.

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::basic_composite_logger ( BOOST_RV_REF(logger_base that)
inline

Move constructor.

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
template<typename ArgsT >
boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::basic_composite_logger ( ArgsT const &  args)
inlineexplicit

Constructor with named parameters.

Member Function Documentation

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
std::pair< attribute_set::iterator, bool > boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::add_attribute ( attribute_name const &  name,
attribute const &  attr 
)
inline

The method adds an attribute to the source-specific attribute set.

The attribute will be implicitly added to every log record made with the current logger.

Parameters
nameThe attribute name.
attrThe attribute factory.
Returns
A pair of values. If the second member is true, then the attribute is added and the first member points to the attribute. Otherwise the attribute was not added and the first member points to the attribute that prevents addition.

References boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
FinalT& boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::assign ( FinalT const &  that)
inlineprotected

Assignment for the final class.

Threadsafe, provides strong exception guarantee.

References boost::addressof(), and boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
attribute_set boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::get_attributes ( ) const
inline

The method retrieves a copy of a set with all attributes from the logger.

Returns
The copy of the attribute set. Attributes are shallow-copied.

References boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
record boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::open_record ( )
inline

The method opens a new log record in the logging core.

Returns
A valid record handle if the logging record is opened successfully, an invalid handle otherwise.

References boost::lock(), and boost::expressions::record.

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
template<typename ArgsT >
record boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::open_record ( ArgsT const &  args)
inline

The method opens a new log record in the logging core.

Parameters
argsA set of additional named arguments. The parameter is ignored.
Returns
A valid record handle if the logging record is opened successfully, an invalid handle otherwise.

References boost::lock(), and boost::expressions::record.

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
void boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::push_record ( BOOST_RV_REF(record rec)
inline

The method pushes the constructed message to the logging core.

Parameters
recThe log record with the formatted message

References boost::lock(), and boost::move().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
void boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::remove_all_attributes ( )
inline

The method removes all attributes from the logger.

All iterators and references to the removed attributes are invalidated.

References boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
void boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::remove_attribute ( attribute_set::iterator  it)
inline

The method removes an attribute from the source-specific attribute set.

Precondition
The attribute was added with the add_attribute call for this instance of the logger.
Postcondition
The attribute is no longer registered as a source-specific attribute for this logger. The iterator is invalidated after removal.
Parameters
itIterator to the previously added attribute.

References boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
void boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::set_attributes ( attribute_set const &  attrs)
inline

The method installs the whole attribute set into the logger.

All iterators and references to elements of the previous set are invalidated. Iterators to the attrs set are not valid to be used with the logger (that is, the logger owns a copy of attrs after completion).

Parameters
attrsThe set of attributes to install into the logger. Attributes are shallow-copied.

References boost::lock().

template<typename CharT , typename FinalT , typename ThreadingModelT , typename FeaturesT >
void boost::sources::basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT >::swap ( basic_composite_logger< CharT, FinalT, ThreadingModelT, FeaturesT > &  that)
inline

Thread-safe implementation of swap.

References boost::lock().


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