UHD 003.005.002-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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:

- at compile time by setting the pre-processor define UHD_LOG_LEVEL.
- at runtime by setting the environment variable UHD_LOG_LEVEL.

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

- Example pre-processor define: -DUHD_LOG_LEVEL=3
- Example pre-processor define: -DUHD_LOG_LEVEL=regularly
- Example environment variable: export UHD_LOG_LEVEL=3
- Example environment variable: export UHD_LOG_LEVEL=regularly

## Macro Definition Documentation

#define UHD_LOG UHD_LOGV(regularly)

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

#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;