Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:25

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   debug_output_backend.hpp
0009  * \author Andrey Semashev
0010  * \date   07.11.2008
0011  *
0012  * The header contains a logging sink backend that outputs log records to the debugger.
0013  */
0014 
0015 #ifndef BOOST_LOG_SINKS_DEBUG_OUTPUT_BACKEND_HPP_INCLUDED_
0016 #define BOOST_LOG_SINKS_DEBUG_OUTPUT_BACKEND_HPP_INCLUDED_
0017 
0018 #include <string>
0019 #include <boost/log/detail/config.hpp>
0020 
0021 #ifdef BOOST_HAS_PRAGMA_ONCE
0022 #pragma once
0023 #endif
0024 
0025 #ifndef BOOST_LOG_WITHOUT_DEBUG_OUTPUT
0026 
0027 #include <boost/log/sinks/basic_sink_backend.hpp>
0028 #include <boost/log/sinks/frontend_requirements.hpp>
0029 #include <boost/log/attributes/attribute_value_set.hpp>
0030 #include <boost/log/core/record_view.hpp>
0031 #include <boost/log/detail/header.hpp>
0032 
0033 namespace boost {
0034 
0035 BOOST_LOG_OPEN_NAMESPACE
0036 
0037 namespace sinks {
0038 
0039 /*!
0040  * \brief An implementation of a logging sink backend that outputs to the debugger
0041  *
0042  * The sink uses Windows API in order to write log records as debug messages, if the
0043  * application process is run under debugger. The sink backend also provides a specific
0044  * filter that allows to check whether the debugger is available and thus elide unnecessary
0045  * formatting.
0046  */
0047 template< typename CharT >
0048 class basic_debug_output_backend :
0049     public basic_formatted_sink_backend< CharT, concurrent_feeding >
0050 {
0051     //! Base type
0052     typedef basic_formatted_sink_backend< CharT, concurrent_feeding > base_type;
0053 
0054 public:
0055     //! Character type
0056     typedef typename base_type::char_type char_type;
0057     //! String type to be used as a message text holder
0058     typedef typename base_type::string_type string_type;
0059 
0060 public:
0061     /*!
0062      * Constructor. Initializes the sink backend.
0063      */
0064     BOOST_LOG_API basic_debug_output_backend();
0065     /*!
0066      * Destructor
0067      */
0068     BOOST_LOG_API ~basic_debug_output_backend();
0069 
0070     /*!
0071      * The method passes the formatted message to debugger
0072      */
0073     BOOST_LOG_API void consume(record_view const& rec, string_type const& formatted_message);
0074 };
0075 
0076 #ifdef BOOST_LOG_USE_CHAR
0077 typedef basic_debug_output_backend< char > debug_output_backend;      //!< Convenience typedef for narrow-character logging
0078 #endif
0079 #ifdef BOOST_LOG_USE_WCHAR_T
0080 typedef basic_debug_output_backend< wchar_t > wdebug_output_backend;  //!< Convenience typedef for wide-character logging
0081 #endif
0082 
0083 } // namespace sinks
0084 
0085 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0086 
0087 } // namespace boost
0088 
0089 #include <boost/log/detail/footer.hpp>
0090 
0091 #endif // BOOST_LOG_WITHOUT_DEBUG_OUTPUT
0092 
0093 #endif // BOOST_LOG_SINKS_DEBUG_OUTPUT_BACKEND_HPP_INCLUDED_