13 #ifndef _LIBQI_QI_LOG_HPP_
14 #define _LIBQI_QI_LOG_HPP_
23 #include <boost/function/function_fwd.hpp>
28 #if defined(NO_QI_DEBUG) || defined(NDEBUG)
29 # define qiLogDebug(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
30 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
31 # define qiLogDebug(...) qi::log::LogStream(qi::log::debug, "", __FUNCTION__, 0, __VA_ARGS__).self()
33 # define qiLogDebug(...) qi::log::LogStream(qi::log::debug, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
37 # define qiLogVerbose(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
38 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
39 # define qiLogVerbose(...) qi::log::LogStream(qi::log::verbose, "", __FUNCTION__, 0, __VA_ARGS__).self()
41 # define qiLogVerbose(...) qi::log::LogStream(qi::log::verbose, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
45 # define qiLogInfo(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
46 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
47 # define qiLogInfo(...) qi::log::LogStream(qi::log::info, "", __FUNCTION__, 0, __VA_ARGS__).self()
49 # define qiLogInfo(...) qi::log::LogStream(qi::log::info, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
53 # define qiLogWarning(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
54 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
55 # define qiLogWarning(...) qi::log::LogStream(qi::log::warning, "", __FUNCTION__, 0, __VA_ARGS__).self()
57 # define qiLogWarning(...) qi::log::LogStream(qi::log::warning, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
61 # define qiLogError(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
62 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
63 # define qiLogError(...) qi::log::LogStream(qi::log::error, "", __FUNCTION__, 0, __VA_ARGS__).self()
65 # define qiLogError(...) qi::log::LogStream(qi::log::error, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
69 # define qiLogFatal(...) if (false) qi::log::detail::NullStream(__VA_ARGS__).self()
70 #elif defined(NO_QI_LOG_DETAILED_CONTEXT) || defined(NDEBUG)
71 # define qiLogFatal(...) qi::log::LogStream(qi::log::fatal, "", __FUNCTION__, 0, __VA_ARGS__).self()
73 # define qiLogFatal(...) qi::log::LogStream(qi::log::fatal, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__).self()
95 NullStream(
const char *, ...)
104 template <
typename T>
105 NullStream& operator<<(
const T &
QI_UNUSED(val))
110 NullStream& operator<<(std::ostream& (*
QI_UNUSED(f))(std::ostream&))
129 typedef boost::function7<void,
140 bool synchronous =
true);
145 const char *category,
147 const char *file =
"",
148 const char *fct =
"",
178 const char *
function,
180 const char *category)
182 , _category(category)
184 , _function(function)
191 const char *
function,
193 const char *category,
194 const char *fmt, ...)
196 , _category(category)
198 , _function(function)
205 vsnprintf_s(buffer, 2048, 2047, fmt, vl);
207 vsnprintf(buffer, 2048, fmt, vl);
216 qi::log::log(_logLevel, _category, this->str().c_str(), _file, _function, _line);
225 const char *_category;
227 const char *_function;
237 #endif // _LIBQI_QI_LOG_HPP_