UHD  003.005.005-0-g3c6a906c
Classes | Namespaces | Macros | Enumerations
log.hpp File Reference
#include <uhd/config.hpp>
#include <uhd/utils/pimpl.hpp>
#include <boost/current_function.hpp>
#include <ostream>
#include <string>

Go to the source code of this file.

Classes

class  uhd::_log::log
 Internal logging object (called by UHD_LOG macros) More...
 

Namespaces

 uhd
 
 uhd::_log
 

Macros

#define UHD_LOGV(verbosity)   uhd::_log::log(uhd::_log::verbosity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)()
 
#define UHD_LOG   UHD_LOGV(regularly)
 

Enumerations

enum  uhd::_log::verbosity_t {
  uhd::_log::always = 1, uhd::_log::often = 2, uhd::_log::regularly = 3, uhd::_log::rarely = 4,
  uhd::_log::very_rarely = 5, uhd::_log::never = 6
}
 Verbosity levels for the logger. More...
 

Detailed Description

The UHD logging facility.

The logger enables UHD library code to easily log events into a file. Log entries are time-stamped and stored with file, line, and function. Each call to the UHD_LOG macros is synchronous and thread-safe.

The log file can be found in the path <temp-directory>/uhd.log, where <temp-directory> is the user or system's temporary directory. To override <temp-directory>, set the UHD_TEMP_PATH environment variable.

All log messages with verbosity greater than or equal to the log level (in other words, as often or less often than the current log level) are recorded into the log file. All other messages are sent to null.

The default log level is "never", but can be overridden:

UHD_LOG_LEVEL can be the name of a verbosity enum or integer value:

Macro Definition Documentation

◆ UHD_LOG

#define UHD_LOG   UHD_LOGV(regularly)

A UHD logger macro with default verbosity. Usage: UHD_LOG << "the log message" << std::endl;

◆ UHD_LOGV

#define UHD_LOGV (   verbosity)    uhd::_log::log(uhd::_log::verbosity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)()

A UHD logger macro with configurable verbosity. Usage: UHD_LOGV(very_rarely) << "the log message" << std::endl;