An implementation of a logging sink backend that emits events into Windows NT event log. More...
#include <event_log_backend.hpp>
Public Types | |
typedef CharT | char_type |
Character type. More... | |
typedef std::basic_string < char_type > | string_type |
String type. More... | |
typedef std::vector< string_type > | insertion_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 () |
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:
basic_simple_event_log_backend
. event_log
namespace. typedef CharT boost::sinks::basic_event_log_backend< CharT >::char_type |
Character type.
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.
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.
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.
|
inherited |
Frontend requirements tag.
typedef std::vector< string_type > boost::sinks::basic_event_log_backend< CharT >::insertion_list |
Type of the composed insertions list.
typedef std::basic_string< char_type > boost::sinks::basic_event_log_backend< CharT >::string_type |
String type.
|
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().
|
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().
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
.args | A set of named parameters. |
Destructor. Unregisters event source. The log source description is not removed from the Windows registry.
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.
rec | Log record to consume |
|
static |
|
static |
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.
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.
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.