Exemplo n.º 1
0
BOOST_LOG_EXPORT void basic_simple_event_log_backend< CharT >::consume(
    record_type const& record, target_string_type const& formatted_message)
{
    const char_type* message = formatted_message.c_str();
    event_log::event_type evt_type = event_log::info;
    if (!m_pImpl->m_LevelMapper.empty())
        evt_type = m_pImpl->m_LevelMapper(record);

    DWORD event_id;
    switch (evt_type)
    {
    case event_log::success:
        event_id = BOOST_LOG_MSG_DEBUG; break;
    case event_log::warning:
        event_id = BOOST_LOG_MSG_WARNING; break;
    case event_log::error:
        event_id = BOOST_LOG_MSG_ERROR; break;
    default:
        event_id = BOOST_LOG_MSG_INFO; break;
    }

    report_event(
        m_pImpl->m_SourceHandle,        // Event log handle.
        static_cast< WORD >(evt_type),  // Event type.
        0,                              // Event category.
        event_id,                       // Event identifier.
        NULL,                           // No user security identifier.
        1,                              // Number of substitution strings.
        0,                              // No data.
        &message,                       // Pointer to strings.
        NULL);                          // No data.
}
void basic_syslog_backend< CharT >::do_consume(
    values_view_type const& attributes, target_string_type const& formatted_message)
{
    const int facility = m_pImpl->m_Facility;
    const int level =
        m_pImpl->m_LevelMapper.empty() ? syslog::info : m_pImpl->m_LevelMapper(attributes);

    ::syslog(LOG_MAKEPRI(facility, level), "%s", formatted_message.c_str());
}
Exemplo n.º 3
0
void basic_debug_output_backend< CharT >::do_consume(record_type const& record, target_string_type const& formatted_message)
{
    output_debug_string(formatted_message.c_str());
}
void basic_debug_output_backend< CharT >::do_consume(values_view_type const& values, target_string_type const& formatted_message)
{
    output_debug_string(formatted_message.c_str());
}
void basic_simple_nt6_event_log_backend< CharT >::do_consume(
    values_view_type const& values, target_string_type const& formatted_message)
{
    EventWriteString(m_pImpl->m_ProviderHandle, m_pImpl->get_level(values), 0ULL /* keyword */, formatted_message.c_str());
}