24 #ifndef DATATOOLS_DETAIL_LOGGER_MACROS_H 25 #define DATATOOLS_DETAIL_LOGGER_MACROS_H 33 #include <boost/current_function.hpp> 46 #define DT_LOG_FATAL(Priority, Message) \ 48 ::datatools::logger::priority _dt_xxx_p = Priority; \ 49 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_FATAL) { \ 50 std::ostringstream _dt_xxx_out; \ 51 _dt_xxx_out << "[fatal:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 52 std::cerr << _dt_xxx_out.str(); \ 64 #define DT_LOG_CRITICAL(Priority, Message) \ 66 ::datatools::logger::priority _dt_xxx_p = Priority; \ 67 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_CRITICAL) { \ 68 std::ostringstream _dt_xxx_out; \ 69 _dt_xxx_out << "[critical:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 70 std::cerr << _dt_xxx_out.str(); \ 82 #define DT_LOG_ERROR(Priority, Message) \ 84 ::datatools::logger::priority _dt_xxx_p = Priority; \ 85 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_ERROR) { \ 86 std::ostringstream _dt_xxx_out; \ 87 _dt_xxx_out << "[error:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 88 std::cerr << _dt_xxx_out.str(); \ 100 #define DT_LOG_WARNING(Priority, Message) \ 102 ::datatools::logger::priority _dt_xxx_p = Priority; \ 103 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_WARNING) { \ 104 std::ostringstream _dt_xxx_out; \ 105 _dt_xxx_out << "[warning:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 106 std::cerr << _dt_xxx_out.str(); \ 118 #define DT_LOG_NOTICE(Priority, Message) \ 120 ::datatools::logger::priority _dt_xxx_p = Priority; \ 121 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_NOTICE) { \ 122 std::ostringstream _dt_xxx_out; \ 123 _dt_xxx_out << "[notice:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 124 std::clog << _dt_xxx_out.str(); \ 136 #define DT_LOG_INFORMATION(Priority, Message) \ 138 ::datatools::logger::priority _dt_xxx_p = Priority; \ 139 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_INFORMATION) { \ 140 std::ostringstream _dt_xxx_out; \ 141 _dt_xxx_out << "[information:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 142 std::clog << _dt_xxx_out.str(); \ 147 #define DT_LOG_DEBUG(Priority, Message) \ 149 ::datatools::logger::priority _dt_xxx_p = Priority; \ 150 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_DEBUG) { \ 151 std::ostringstream _dt_xxx_out; \ 152 _dt_xxx_out << "[debug:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 153 std::cerr << _dt_xxx_out.str(); \ 170 #define DT_LOG_INFORMATION_SHORT(Priority, Message) \ 172 ::datatools::logger::priority _dt_xxx_p = Priority; \ 173 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_INFORMATION) { \ 174 std::ostringstream _dt_xxx_out; \ 175 _dt_xxx_out << "[debug] " << Message << std::endl; \ 176 std::clog << _dt_xxx_out.str(); \ 193 #define DT_LOG_NOTICE_SHORT(Priority, Message) \ 195 ::datatools::logger::priority _dt_xxx_p = Priority; \ 196 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_NOTICE) { \ 197 std::ostringstream _dt_xxx_out; \ 198 _dt_xxx_out << "[debug] " << Message << std::endl; \ 199 std::clog << _dt_xxx_out.str(); \ 216 #define DT_LOG_DEBUG_SHORT(Priority, Message) \ 218 ::datatools::logger::priority _dt_xxx_p = Priority; \ 219 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_DEBUG) { \ 220 std::ostringstream _dt_xxx_out; \ 221 _dt_xxx_out << "[debug] " << Message << std::endl; \ 222 std::cerr << _dt_xxx_out.str(); \ 227 #define DT_LOG_TRACE(Priority, Message) \ 229 ::datatools::logger::priority _dt_xxx_p = Priority; \ 230 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_TRACE) { \ 231 std::ostringstream _dt_xxx_out; \ 232 _dt_xxx_out << "[trace:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \ 233 std::cerr << _dt_xxx_out.str(); \ 250 #define DT_LOG_TRACE_SHORT(Priority, Message) \ 252 ::datatools::logger::priority _dt_xxx_p = Priority; \ 253 if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_TRACE) { \ 254 std::ostringstream _dt_xxx_out; \ 255 _dt_xxx_out << "[trace] " << Message << std::endl; \ 256 std::clog << _dt_xxx_out.str(); \ 261 #define DT_LOG_TRACE_ENTERING(Priority) \ 263 DT_LOG_TRACE(Priority, "Entering..."); \ 267 #define DT_LOG_TRACE_EXITING(Priority) \ 269 DT_LOG_TRACE(Priority, "Exiting."); \ 272 #endif // DATATOOLS_DETAIL_LOGGER_MACROS_H Utilities for logging information.