An implementation of a simple logging sink backend that emits events into Windows NT event log. More...
#include <event_log_backend.hpp>
Public Types | |
typedef base_type::char_type | char_type |
Character type. More... | |
typedef base_type::string_type | string_type |
String type to be used as a message text holder. 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 base_type::frontend_requirements | frontend_requirements |
Frontend requirements. More... | |
Public Member Functions | |
BOOST_LOG_API | basic_simple_event_log_backend () |
Default constructor. More... | |
BOOST_LOG_API | ~basic_simple_event_log_backend () |
Constructor. 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 | consume (record_view const &rec, string_type const &formatted_message) |
The method puts the formatted message to the event log. 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 simple 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 in terms of the API, it implements all needed resources and source registration in the Windows registry that is needed for the event delivery.
The backend performs message text formatting. The composed text is then passed as the first and only string parameter of the event. The resource embedded into the backend describes the event so that the parameter is inserted into the event description text, thus making it visible in the event log.
The backend allows to customize mapping of application severity levels to the native Windows event types. This allows to write portable code even if OS-specific sinks, such as this one, are used.
typedef base_type::char_type boost::sinks::basic_simple_event_log_backend< CharT >::char_type |
Character type.
typedef boost::log::aux::light_function< event_log::event_type (record_view const&) > boost::sinks::basic_simple_event_log_backend< CharT >::event_type_mapper_type |
Mapper type for the event type.
|
inherited |
Frontend requirements.
typedef base_type::string_type boost::sinks::basic_simple_event_log_backend< CharT >::string_type |
String type to be used as a message text holder.
BOOST_LOG_API boost::sinks::basic_simple_event_log_backend< CharT >::basic_simple_event_log_backend | ( | ) |
Default 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.
BOOST_LOG_API boost::sinks::basic_simple_event_log_backend< CharT >::~basic_simple_event_log_backend | ( | ) |
Constructor.
Registers event log source with the specified parameters. The following named parameters are supported:
target
- Specifies an UNC path to the remote server 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_simple_event_log_backend< CharT >::consume | ( | record_view const & | rec, |
string_type const & | formatted_message | ||
) |
The method puts the formatted message to the event log.
|
static |
|
static |
BOOST_LOG_API void boost::sinks::basic_simple_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.