Basic logger class. More...
#include <basic_logger.hpp>
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_model > | push_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_set & | attributes () |
An accessor to the logger attributes. More... | |
attribute_set const & | attributes () const |
An accessor to the logger attributes. More... | |
threading_model & | get_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_type * | final_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... | |
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.
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.
typedef CharT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::char_type |
Character type.
typedef FinalT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::final_type |
Final logger type.
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.
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.
typedef no_lock< threading_model > boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::push_record_lock |
Lock requirement for the push_record_unlocked method.
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.
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.
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.
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.
typedef ThreadingModelT boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::threading_model |
Threading model type.
|
inline |
Constructor.
Initializes internal data structures of the basic logger class, acquires reference to the logging core.
|
inline |
Copy constructor.
Copies all attributes from the source logger.
that | Source logger |
|
inline |
Move constructor.
Moves all attributes from the source logger.
that | Source logger |
References boost::attribute_set::swap(), and boost::shared_ptr< T >::swap().
|
inlineexplicit |
Constructor with named arguments.
The constructor ignores all arguments. The result of construction is equivalent to default construction.
|
inlineprotected |
Unlocked add_attribute
.
References boost::attribute_set::insert().
|
inlineprotected |
An accessor to the logger attributes.
|
inlineprotected |
An accessor to the logger attributes.
|
inlineprotected |
An accessor to the logging system pointer.
|
inlineprotected |
An accessor to the final logger.
|
inlineprotected |
An accessor to the final logger.
References boost::detail::const.
|
inlineprotected |
Unlocked get_attributes
.
|
inlineprotected |
An accessor to the threading model base.
Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::swap_unlocked().
|
inlineprotected |
An accessor to the threading model base.
|
inlineprotected |
Unlocked open_record
.
|
inlineprotected |
Unlocked open_record
.
|
inlineprotected |
Unlocked push_record
.
References boost::move().
|
inlineprotected |
Unlocked remove_all_attributes
.
References boost::attribute_set::clear().
|
inlineprotected |
Unlocked remove_attribute
.
References boost::attribute_set::erase().
|
inlineprotected |
Unlocked set_attributes
.
|
inlineprotected |
Unlocked swap
.
References boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::get_threading_model(), and boost::attribute_set::swap().