2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
9 * \author Andrey Semashev
12 * This header contains the \c to_log output manipulator.
15 #ifndef BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
16 #define BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
19 #include <boost/core/enable_if.hpp>
20 #include <boost/log/detail/config.hpp>
21 #include <boost/log/detail/is_ostream.hpp>
22 #include <boost/log/utility/formatting_ostream_fwd.hpp>
23 #include <boost/log/detail/header.hpp>
25 #ifdef BOOST_HAS_PRAGMA_ONCE
31 BOOST_LOG_OPEN_NAMESPACE
34 * \brief Generic manipulator for customizing output to log
36 template< typename T, typename TagT = void >
43 typedef TagT tag_type;
46 //! Reference to the value
47 value_type const& m_value;
50 explicit to_log_manip(value_type const& value) BOOST_NOEXCEPT : m_value(value) {}
51 to_log_manip(to_log_manip const& that) BOOST_NOEXCEPT : m_value(that.m_value) {}
53 value_type const& get() const BOOST_NOEXCEPT { return m_value; }
56 template< typename StreamT, typename T, typename TagT >
57 inline typename enable_if_c< log::aux::is_ostream< StreamT >::value, StreamT& >::type operator<< (StreamT& strm, to_log_manip< T, TagT > manip)
63 template< typename T >
64 inline to_log_manip< T > to_log(T const& value) BOOST_NOEXCEPT
66 return to_log_manip< T >(value);
69 template< typename TagT, typename T >
70 inline to_log_manip< T, TagT > to_log(T const& value) BOOST_NOEXCEPT
72 return to_log_manip< T, TagT >(value);
75 BOOST_LOG_CLOSE_NAMESPACE // namespace log
79 #include <boost/log/detail/footer.hpp>
81 #endif // BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_