8 #ifndef INCLUDED_UHD_UTILS_LOG_HPP 9 #define INCLUDED_UHD_UTILS_LOG_HPP 12 #include <boost/current_function.hpp> 13 #include <boost/thread/thread.hpp> 121 : verbosity(
uhd::log::
off) {}
123 const boost::posix_time::ptime &time_,
125 const std::string &file_,
127 const std::string &component_,
128 const boost::thread::id &thread_id_
130 verbosity(verbosity_),
133 component(component_),
134 thread_id(thread_id_)
179 #define _UHD_LOG_INTERNAL(component, level) \ 180 uhd::_log::log(level, __FILE__, __LINE__, component, boost::this_thread::get_id()) 184 #if UHD_LOG_MIN_LEVEL < 1 185 #define UHD_LOG_TRACE(component, message) \ 186 _UHD_LOG_INTERNAL(component, uhd::log::trace) << message; 188 #define UHD_LOG_TRACE(component, message) 191 #if UHD_LOG_MIN_LEVEL < 2 192 #define UHD_LOG_DEBUG(component, message) \ 193 _UHD_LOG_INTERNAL(component, uhd::log::debug) << message; 195 #define UHD_LOG_DEBUG(component, message) 198 #if UHD_LOG_MIN_LEVEL < 3 199 #define UHD_LOG_INFO(component, message) \ 200 _UHD_LOG_INTERNAL(component, uhd::log::info) << message; 202 #define UHD_LOG_INFO(component, message) 205 #if UHD_LOG_MIN_LEVEL < 4 206 #define UHD_LOG_WARNING(component, message) \ 207 _UHD_LOG_INTERNAL(component, uhd::log::warning) << message; 209 #define UHD_LOG_WARNING(component, message) 212 #if UHD_LOG_MIN_LEVEL < 5 213 #define UHD_LOG_ERROR(component, message) \ 214 _UHD_LOG_INTERNAL(component, uhd::log::error) << message; 216 #define UHD_LOG_ERROR(component, message) 219 #if UHD_LOG_MIN_LEVEL < 6 220 #define UHD_LOG_FATAL(component, message) \ 221 _UHD_LOG_INTERNAL(component, uhd::log::fatal) << message; 223 #define UHD_LOG_FATAL(component, message) 226 #ifndef UHD_LOG_FASTPATH_DISABLE 231 #define UHD_LOG_FASTPATH(message) \ 232 uhd::_log::log_fastpath(message); 234 #define UHD_LOG_FASTPATH(message) 238 #define UHD_LOGGER_TRACE(component) _UHD_LOG_INTERNAL(component, uhd::log::trace) 239 #define UHD_LOGGER_DEBUG(component) _UHD_LOG_INTERNAL(component, uhd::log::debug) 240 #define UHD_LOGGER_INFO(component) _UHD_LOG_INTERNAL(component, uhd::log::info) 241 #define UHD_LOGGER_WARNING(component) _UHD_LOG_INTERNAL(component, uhd::log::warning) 242 #define UHD_LOGGER_ERROR(component) _UHD_LOG_INTERNAL(component, uhd::log::error) 243 #define UHD_LOGGER_FATAL(component) _UHD_LOG_INTERNAL(component, uhd::log::fatal) 246 #if defined(__GNUG__) 249 UHD_LOGGER_DEBUG("DEBUG") << __FILE__ << ":" << __LINE__ << " (" << __PRETTY_FUNCTION__ << ")"; 253 UHD_LOGGER_DEBUG("DEBUG") << __FILE__ << ":" << __LINE__; 257 #define UHD_VAR(var) \ 258 UHD_LOGGER_DEBUG("DEBUG") << #var << " = " << var; 261 #define UHD_HEX(var) \ 262 UHD_LOGGER_DEBUG("DEBUG") << #var << " = 0x" << std::hex << std::setfill('0') << std::setw(8) << var << std::dec; 265 namespace uhd{
namespace _log {
268 void UHD_API log_fastpath(
const std::string &);
275 const std::string &file,
276 const unsigned int line,
277 const std::string &component,
278 const boost::thread::id thread_id
285 #define INSERTION_OVERLOAD(x) log& operator<< (x) \ 294 template <
typename T>
295 INSERTION_OVERLOAD(T val)
298 INSERTION_OVERLOAD(std::ostream& (*val)(std::ostream&))
299 INSERTION_OVERLOAD(std::ios& (*val)(std::ios&))
300 INSERTION_OVERLOAD(std::ios_base& (*val)(std::ios_base&))
304 std::ostringstream _ss;
boost::posix_time::ptime time
Definition: log.hpp:137
std::string file
Definition: log.hpp:139
unsigned int line
Definition: log.hpp:140
logging_info()
Definition: log.hpp:120
severity_level
Definition: log.hpp:104
logging_info(const boost::posix_time::ptime &time_, const uhd::log::severity_level &verbosity_, const std::string &file_, const size_t &line_, const std::string &component_, const boost::thread::id &thread_id_)
Definition: log.hpp:122
Definition: build_info.hpp:14
UHD_API void set_file_level(uhd::log::severity_level level)
uhd::log::severity_level verbosity
Definition: log.hpp:138
UHD_API void set_log_level(uhd::log::severity_level level)
UHD_API void set_logger_level(const std::string &logger, uhd::log::severity_level level)
boost::thread::id thread_id
Definition: log.hpp:142
#define UHD_API
Definition: config.h:63
std::string message
Definition: log.hpp:143
UHD_API void set_console_level(uhd::log::severity_level level)
std::string component
Definition: log.hpp:141