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_event_log_backend< CharT > Class Template Reference

An implementation of a logging sink backend that emits events into Windows NT event log. More...

#include <event_log_backend.hpp>

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

Public Types

typedef CharT char_type
 Character type. More...
 
typedef std::basic_string
< char_type
string_type
 String type. More...
 
typedef std::vector< string_typeinsertion_list
 Type of the composed insertions list. More...
 
typedef
boost::log::aux::light_function
< event_log::event_type(record_view
const &) > 
event_type_mapper_type
 Mapper type for the event type. More...
 
typedef
boost::log::aux::light_function
< event_log::event_category(record_view
const &) > 
event_category_mapper_type
 Mapper type for the event category. More...
 
typedef
boost::log::aux::light_function
< event_log::event_id(record_view
const &, insertion_list &) > 
event_composer_type
 Event composer type. More...
 
typedef synchronized_feeding frontend_requirements
 Frontend requirements tag. More...
 

Public Member Functions

template<typename T >
 basic_event_log_backend (std::basic_string< T > const &message_file_name)
 Constructor. More...
 
 basic_event_log_backend (filesystem::path const &message_file_name)
 Constructor. More...
 
BOOST_LOG_API ~basic_event_log_backend ()
 Constructor. More...
 
BOOST_LOG_API void consume (record_view const &rec)
 The method creates an event in the event log. More...
 
BOOST_LOG_API void set_event_type_mapper (event_type_mapper_type const &mapper)
 The method installs the function object that maps application severity levels to WinAPI event types. More...
 
BOOST_LOG_API void set_event_category_mapper (event_category_mapper_type const &mapper)
 The method installs the function object that extracts event category from attribute values. More...
 
BOOST_LOG_API void set_event_composer (event_composer_type const &composer)
 The method installs the function object that extracts event identifier from the attributes and creates insertion strings that will replace placeholders in the event message. More...
 

Static Public Member Functions

static BOOST_LOG_API string_type get_default_log_name ()
 
static BOOST_LOG_API string_type get_default_source_name ()
 

Detailed Description

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

An implementation of a logging sink backend that emits events into Windows NT event log.

The sink uses Windows NT 5 (Windows 2000) and later event log API to emit events to an event log. The sink acts as an event source. Unlike basic_simple_event_log_backend, this sink backend allows users to specify the custom event message file and supports mapping attribute values onto several insertion strings. Although it requires considerably more scaffolding than the simple backend, this allows to support localizable event descriptions.

Besides the file name of the module with event resources, the backend provides the following customizations:

  • Remote server UNC address, log name and source name. These parameters have similar meaning to basic_simple_event_log_backend.
  • Event type and category mappings. These are function object that allow to map attribute values to the according event parameters. One can use mappings in the event_log namespace.
  • Event composer. This function object extracts event identifier and formats string insertions, that will be used by the API to compose the final event message text.

Member Typedef Documentation

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

Character type.

template<typename CharT >
typedef boost::log::aux::light_function< event_log::event_category (record_view const&) > boost::sinks::basic_event_log_backend< CharT >::event_category_mapper_type

Mapper type for the event category.

template<typename CharT >
typedef boost::log::aux::light_function< event_log::event_id (record_view const&, insertion_list&) > boost::sinks::basic_event_log_backend< CharT >::event_composer_type

Event composer type.

template<typename CharT >
typedef boost::log::aux::light_function< event_log::event_type (record_view const&) > boost::sinks::basic_event_log_backend< CharT >::event_type_mapper_type

Mapper type for the event type.

template<typename CharT >
typedef std::vector< string_type > boost::sinks::basic_event_log_backend< CharT >::insertion_list

Type of the composed insertions list.

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

String type.

Constructor & Destructor Documentation

template<typename CharT >
template<typename T >
boost::sinks::basic_event_log_backend< CharT >::basic_event_log_backend ( std::basic_string< T > const &  message_file_name)
inlineexplicit

Constructor.

Registers event source with name based on the application executable file name in the Application log. If such a registration is already present, it is not overridden.

References boost::icl::construct().

template<typename CharT >
boost::sinks::basic_event_log_backend< CharT >::basic_event_log_backend ( filesystem::path const &  message_file_name)
inlineexplicit

Constructor.

Registers event source with name based on the application executable file name in the Application log. If such a registration is already present, it is not overridden.

References boost::icl::construct().

template<typename CharT >
BOOST_LOG_API boost::sinks::basic_event_log_backend< CharT >::~basic_event_log_backend ( )

Constructor.

Registers event log source with the specified parameters. The following named parameters are supported:

  • message_file - Specifies the file name that contains resources that describe events and categories.
  • target - Specifies an UNC path to the remote server to which log records should be sent to. The local machine will be used to process log records, if not specified.
  • log_name - Specifies the log in which the source should be registered. The result of get_default_log_name is used, if the parameter is not specified.
  • log_source - Specifies the source name. The result of get_default_source_name is used, if the parameter is not specified.
  • registration - Specifies the event source registration mode in the Windows registry. Can have values of the registration_mode enum. Default value: on_demand.
Parameters
argsA set of named parameters.

Destructor. Unregisters event source. The log source description is not removed from the Windows registry.

Member Function Documentation

template<typename CharT >
BOOST_LOG_API void boost::sinks::basic_event_log_backend< CharT >::consume ( record_view const &  rec)

The method creates an event in the event log.

Parameters
recLog record to consume
template<typename CharT >
static BOOST_LOG_API string_type boost::sinks::basic_event_log_backend< CharT >::get_default_log_name ( )
static
Returns
Default log name: Application
template<typename CharT >
static BOOST_LOG_API string_type boost::sinks::basic_event_log_backend< CharT >::get_default_source_name ( )
static
Returns
Default log source name that is based on the application executable file name and the sink name
template<typename CharT >
BOOST_LOG_API void boost::sinks::basic_event_log_backend< CharT >::set_event_category_mapper ( event_category_mapper_type const &  mapper)

The method installs the function object that extracts event category from attribute values.

template<typename CharT >
BOOST_LOG_API void boost::sinks::basic_event_log_backend< CharT >::set_event_composer ( event_composer_type const &  composer)

The method installs the function object that extracts event identifier from the attributes and creates insertion strings that will replace placeholders in the event message.

template<typename CharT >
BOOST_LOG_API void boost::sinks::basic_event_log_backend< CharT >::set_event_type_mapper ( event_type_mapper_type const &  mapper)

The method installs the function object that maps application severity levels to WinAPI event types.


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