123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- #ifndef BOOST_LOG_TRIVIAL_HPP_INCLUDED_
- #define BOOST_LOG_TRIVIAL_HPP_INCLUDED_
- #include <iosfwd>
- #include <ostream>
- #include <boost/log/detail/config.hpp>
- #include <boost/log/keywords/severity.hpp>
- #include <boost/log/sources/severity_logger.hpp>
- #include <boost/log/sources/record_ostream.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- #if !defined(BOOST_LOG_USE_CHAR)
- #error Boost.Log: Trivial logging is available for narrow-character builds only. Use advanced initialization routines to setup wide-character logging.
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- namespace trivial {
- enum severity_level
- {
- trace,
- debug,
- info,
- warning,
- error,
- fatal
- };
- BOOST_LOG_API const char* to_string(severity_level lvl);
- template< typename CharT, typename TraitsT >
- inline std::basic_ostream< CharT, TraitsT >& operator<< (
- std::basic_ostream< CharT, TraitsT >& strm, severity_level lvl)
- {
- const char* str = boost::log::trivial::to_string(lvl);
- if (str)
- strm << str;
- else
- strm << static_cast< int >(lvl);
- return strm;
- }
- template< typename CharT, typename TraitsT >
- BOOST_LOG_API std::basic_istream< CharT, TraitsT >& operator>> (
- std::basic_istream< CharT, TraitsT >& strm, severity_level& lvl);
- #if !defined(BOOST_LOG_NO_THREADS)
- typedef sources::severity_logger_mt< severity_level > logger_type;
- #else
- typedef sources::severity_logger< severity_level > logger_type;
- #endif
- struct logger
- {
-
- typedef trivial::logger_type logger_type;
-
- static BOOST_LOG_API logger_type& get();
-
- #if !defined(BOOST_LOG_DOXYGEN_PASS)
- enum registration_line_t { registration_line = __LINE__ };
- static const char* registration_file() { return __FILE__; }
- static BOOST_LOG_API logger_type construct_logger();
- #endif
- };
- #define BOOST_LOG_TRIVIAL(lvl)\
- BOOST_LOG_STREAM_WITH_PARAMS(::boost::log::trivial::logger::get(),\
- (::boost::log::keywords::severity = ::boost::log::trivial::lvl))
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #if defined(BOOST_LOG_EXPRESSIONS_KEYWORD_HPP_INCLUDED_)
- #include <boost/log/detail/trivial_keyword.hpp>
- #endif
- #endif
|