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_logger< CharT, FinalT, ThreadingModelT > Class Template Reference

Basic logger class. More...

#include <basic_logger.hpp>

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

Public Types

typedef CharT char_type
 Character type. More...
 
typedef FinalT final_type
 Final logger type. More...
 
typedef ThreadingModelT threading_model
 Threading model type. More...
 
typedef
boost::log::aux::exclusive_lock_guard
< threading_model
swap_lock
 Lock requirement for the swap_unlocked method. More...
 
typedef
boost::log::aux::exclusive_lock_guard
< threading_model
add_attribute_lock
 Lock requirement for the add_attribute_unlocked method. More...
 
typedef
boost::log::aux::exclusive_lock_guard
< threading_model
remove_attribute_lock
 Lock requirement for the remove_attribute_unlocked method. More...
 
typedef
boost::log::aux::exclusive_lock_guard
< threading_model
remove_all_attributes_lock
 Lock requirement for the remove_all_attributes_unlocked method. More...
 
typedef
boost::log::aux::shared_lock_guard
< const threading_model
get_attributes_lock
 Lock requirement for the get_attributes method. More...
 
typedef
boost::log::aux::shared_lock_guard
< threading_model
open_record_lock
 Lock requirement for the open_record_unlocked method. More...
 
typedef
boost::log::aux::exclusive_lock_guard
< threading_model
set_attributes_lock
 Lock requirement for the set_attributes method. More...
 
typedef no_lock< threading_modelpush_record_lock
 Lock requirement for the push_record_unlocked method. More...
 

Public Member Functions

 basic_logger ()
 Constructor. More...
 
 basic_logger (basic_logger const &that)
 Copy constructor. More...
 
 basic_logger (BOOST_RV_REF(basic_logger) that)
 Move constructor. More...
 
template<typename ArgsT >
 basic_logger (ArgsT const &)
 Constructor with named arguments. More...
 

Protected Member Functions

core_ptr const & core () const
 An accessor to the logging system pointer. More...
 
attribute_setattributes ()
 An accessor to the logger attributes. More...
 
attribute_set const & attributes () const
 An accessor to the logger attributes. More...
 
threading_modelget_threading_model ()
 An accessor to the threading model base. More...
 
threading_model const & get_threading_model () const
 An accessor to the threading model base. More...
 
final_typefinal_this ()
 An accessor to the final logger. More...
 
final_type const * final_this () const
 An accessor to the final logger. More...
 
void swap_unlocked (basic_logger &that)
 Unlocked swap. More...
 
std::pair
< attribute_set::iterator,
bool > 
add_attribute_unlocked (attribute_name const &name, attribute const &attr)
 Unlocked add_attribute. More...
 
void remove_attribute_unlocked (attribute_set::iterator it)
 Unlocked remove_attribute. More...
 
void remove_all_attributes_unlocked ()
 Unlocked remove_all_attributes. More...
 
record open_record_unlocked ()
 Unlocked open_record. More...
 
template<typename ArgsT >
record open_record_unlocked (ArgsT const &)
 Unlocked open_record. More...
 
void push_record_unlocked (BOOST_RV_REF(record) rec)
 Unlocked push_record. More...
 
attribute_set get_attributes_unlocked () const
 Unlocked get_attributes. More...
 
void set_attributes_unlocked (attribute_set const &attrs)
 Unlocked set_attributes. More...
 

Detailed Description

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

Basic logger class.

The basic_logger class template serves as a base class for all loggers provided by the library. It can also be used as a base for user-defined loggers. The template parameters are:

  • CharT - logging character type
  • FinalT - final type of the logger that eventually derives from the basic_logger. There may be other classes in the hierarchy between the final class and basic_logger.
  • ThreadingModelT - threading model policy. Must provide methods of the Boost.Thread locking concept used in basic_logger class and all its derivatives in the hierarchy up to the FinalT class. The basic_logger class itself requires methods of the SharedLockable concept. The threading model policy must also be default and copy-constructible and support member function swap. There are currently two policies provided: single_thread_model and multi_thread_model.

The logger implements fundamental facilities of loggers, such as storing source-specific attribute set and formatting log record messages. The basic logger interacts with the logging core in order to apply filtering and pass records to sinks.

Member Typedef Documentation

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::exclusive_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::add_attribute_lock

Lock requirement for the add_attribute_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef CharT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::char_type

Character type.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef FinalT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::final_type

Final logger type.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::shared_lock_guard< const threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::get_attributes_lock

Lock requirement for the get_attributes method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::shared_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::open_record_lock

Lock requirement for the open_record_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef no_lock< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::push_record_lock

Lock requirement for the push_record_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::exclusive_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_all_attributes_lock

Lock requirement for the remove_all_attributes_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::exclusive_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_attribute_lock

Lock requirement for the remove_attribute_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::exclusive_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::set_attributes_lock

Lock requirement for the set_attributes method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef boost::log::aux::exclusive_lock_guard< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::swap_lock

Lock requirement for the swap_unlocked method.

template<typename CharT, typename FinalT, typename ThreadingModelT>
typedef ThreadingModelT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::threading_model

Threading model type.

Constructor & Destructor Documentation

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

Constructor.

Initializes internal data structures of the basic logger class, acquires reference to the logging core.

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

Copy constructor.

Copies all attributes from the source logger.

Note
Not thread-safe. The source logger must be locked in the final class before copying.
Parameters
thatSource logger
template<typename CharT, typename FinalT, typename ThreadingModelT>
boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::basic_logger ( BOOST_RV_REF(basic_logger< CharT, FinalT, ThreadingModelT >)  that)
inline

Move constructor.

Moves all attributes from the source logger.

Note
Not thread-safe. The source logger must be locked in the final class before copying.
Parameters
thatSource logger

References boost::attribute_set::swap(), and boost::shared_ptr< T >::swap().

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

Constructor with named arguments.

The constructor ignores all arguments. The result of construction is equivalent to default construction.

Member Function Documentation

template<typename CharT, typename FinalT, typename ThreadingModelT>
std::pair< attribute_set::iterator, bool > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::add_attribute_unlocked ( attribute_name const &  name,
attribute const &  attr 
)
inlineprotected

Unlocked add_attribute.

References boost::attribute_set::insert().

template<typename CharT, typename FinalT, typename ThreadingModelT>
attribute_set& boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::attributes ( )
inlineprotected

An accessor to the logger attributes.

template<typename CharT, typename FinalT, typename ThreadingModelT>
attribute_set const& boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::attributes ( ) const
inlineprotected

An accessor to the logger attributes.

template<typename CharT, typename FinalT, typename ThreadingModelT>
core_ptr const& boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::core ( ) const
inlineprotected

An accessor to the logging system pointer.

template<typename CharT, typename FinalT, typename ThreadingModelT>
final_type* boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::final_this ( )
inlineprotected

An accessor to the final logger.

template<typename CharT, typename FinalT, typename ThreadingModelT>
final_type const* boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::final_this ( ) const
inlineprotected

An accessor to the final logger.

References boost::detail::const.

template<typename CharT, typename FinalT, typename ThreadingModelT>
attribute_set boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::get_attributes_unlocked ( ) const
inlineprotected

Unlocked get_attributes.

template<typename CharT, typename FinalT, typename ThreadingModelT>
threading_model& boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::get_threading_model ( )
inlineprotected

An accessor to the threading model base.

Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::swap_unlocked().

template<typename CharT, typename FinalT, typename ThreadingModelT>
threading_model const& boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::get_threading_model ( ) const
inlineprotected

An accessor to the threading model base.

template<typename CharT, typename FinalT, typename ThreadingModelT>
record boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::open_record_unlocked ( )
inlineprotected

Unlocked open_record.

template<typename CharT, typename FinalT, typename ThreadingModelT>
template<typename ArgsT >
record boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::open_record_unlocked ( ArgsT const &  )
inlineprotected

Unlocked open_record.

template<typename CharT, typename FinalT, typename ThreadingModelT>
void boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::push_record_unlocked ( BOOST_RV_REF(record rec)
inlineprotected

Unlocked push_record.

References boost::move().

template<typename CharT, typename FinalT, typename ThreadingModelT>
void boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_all_attributes_unlocked ( )
inlineprotected

Unlocked remove_all_attributes.

References boost::attribute_set::clear().

template<typename CharT, typename FinalT, typename ThreadingModelT>
void boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_attribute_unlocked ( attribute_set::iterator  it)
inlineprotected

Unlocked remove_attribute.

References boost::attribute_set::erase().

template<typename CharT, typename FinalT, typename ThreadingModelT>
void boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::set_attributes_unlocked ( attribute_set const &  attrs)
inlineprotected

Unlocked set_attributes.

template<typename CharT, typename FinalT, typename ThreadingModelT>
void boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::swap_unlocked ( basic_logger< CharT, FinalT, ThreadingModelT > &  that)
inlineprotected

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