2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
22 #if defined(_MSC_VER)
\r
23 #pragma warning (push)
\r
24 #pragma warning (disable : 4100)
\r
25 #pragma warning (disable : 4127) // conditional expression is constant
\r
26 #pragma warning (disable : 4512)
\r
27 #pragma warning (disable : 4714) // marked as __forceinline not inlined
\r
28 #pragma warning (disable : 4996) // _CRT_SECURE_NO_WARNINGS
\r
31 #include <boost/log/detail/prologue.hpp>
\r
32 #include <boost/log/keywords/severity.hpp>
\r
33 #include <boost/log/sources/global_logger_storage.hpp>
\r
34 #include <boost/log/sources/severity_logger.hpp>
\r
35 #include <boost/log/sources/record_ostream.hpp>
\r
37 namespace caspar { namespace log {
\r
43 void add_file_sink(const std::wstring& folder);
\r
55 template< typename CharT, typename TraitsT >
\r
56 inline std::basic_ostream< CharT, TraitsT >& operator<< (
\r
57 std::basic_ostream< CharT, TraitsT >& strm, severity_level lvl)
\r
61 else if(lvl == debug)
\r
63 else if(lvl == info)
\r
65 else if(lvl == warning)
\r
67 else if(lvl == error)
\r
69 else if(lvl == fatal)
\r
72 strm << static_cast<int>(lvl);
\r
77 typedef boost::log::sources::wseverity_logger_mt<severity_level> caspar_logger;
\r
79 BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
\r
82 return caspar_logger(boost::log::keywords::severity = trace);
\r
85 #define CASPAR_LOG(lvl)\
\r
86 BOOST_LOG_STREAM_WITH_PARAMS(::caspar::log::get_logger(),\
\r
87 (::boost::log::keywords::severity = ::caspar::log::lvl))
\r
89 #define CASPAR_LOG_CURRENT_EXCEPTION() \
\r
91 {CASPAR_LOG(error) << boost::current_exception_diagnostic_information().c_str();}\
\r
94 void set_log_level(const std::wstring& lvl);
\r
98 #if defined(_MSC_VER)
\r
99 #pragma warning (pop)
\r