mirror of
https://github.com/boostorg/log.git
synced 2026-02-13 00:22:22 +00:00
Boost.Log merged to trunk.
[SVN r83860]
This commit is contained in:
78
src/debug_output_backend.cpp
Normal file
78
src/debug_output_backend.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2007 - 2013.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file debug_output_backend.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 08.11.2008
|
||||
*
|
||||
* \brief A logging sink backend that uses debugger output
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_WITHOUT_DEBUG_OUTPUT
|
||||
|
||||
#include "windows_version.hpp"
|
||||
#include <string>
|
||||
#include <boost/log/sinks/debug_output_backend.hpp>
|
||||
#include <windows.h>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
namespace sinks {
|
||||
|
||||
BOOST_LOG_ANONYMOUS_NAMESPACE {
|
||||
|
||||
#if defined(BOOST_LOG_USE_CHAR)
|
||||
inline void output_debug_string(const char* str)
|
||||
{
|
||||
OutputDebugStringA(str);
|
||||
}
|
||||
#endif // defined(BOOST_LOG_USE_CHAR)
|
||||
#if defined(BOOST_LOG_USE_WCHAR_T)
|
||||
inline void output_debug_string(const wchar_t* str)
|
||||
{
|
||||
OutputDebugStringW(str);
|
||||
}
|
||||
#endif // defined(BOOST_LOG_USE_WCHAR_T)
|
||||
|
||||
} // namespace
|
||||
|
||||
template< typename CharT >
|
||||
BOOST_LOG_API basic_debug_output_backend< CharT >::basic_debug_output_backend()
|
||||
{
|
||||
}
|
||||
|
||||
template< typename CharT >
|
||||
BOOST_LOG_API basic_debug_output_backend< CharT >::~basic_debug_output_backend()
|
||||
{
|
||||
}
|
||||
|
||||
//! The method puts the formatted message to the event log
|
||||
template< typename CharT >
|
||||
BOOST_LOG_API void basic_debug_output_backend< CharT >::consume(record_view const&, string_type const& formatted_message)
|
||||
{
|
||||
output_debug_string(formatted_message.c_str());
|
||||
}
|
||||
|
||||
#ifdef BOOST_LOG_USE_CHAR
|
||||
template class basic_debug_output_backend< char >;
|
||||
#endif
|
||||
#ifdef BOOST_LOG_USE_WCHAR_T
|
||||
template class basic_debug_output_backend< wchar_t >;
|
||||
#endif
|
||||
|
||||
} // namespace sinks
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // !defined(BOOST_LOG_WITHOUT_DEBUG_OUTPUT)
|
||||
Reference in New Issue
Block a user