Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
Classes related to logging

Classes

class  viam::sdk::LogManager
 Manages the logging infrastructure in the SDDK. More...
 

Macros

#define VIAM_SDK_LOG(level)   VIAM_SDK_LOG_IMPL(::viam::sdk::LogManager::get().global_logger(), level)
 Log macro for general SDK logs.
 
#define VIAM_MODULE_LOG(level)    VIAM_SDK_LOG_IMPL(::viam::sdk::LogManager::get().module_logger(), level)
 Log macro for logs related to a module.
 
#define VIAM_RESOURCE_LOG(...)
 Log macro for resource-level logs, allowing resource-level filtering.
 

Typedefs

using viam::sdk::LogSource = boost::log::sources::severity_channel_logger_mt<log_level>
 Type alias for the log source in the C++ SDK.
 

Enumerations

enum class  viam::sdk::log_level : std::int8_t {
  trace = -2 , debug = -1 , info = 0 , warn = 1 ,
  error = 2 , fatal = 3
}
 Severity levels for the logger. More...
 

Functions

const char * viam::sdk::global_resource_name ()
 Returns the "channel name" of general log messages related to the Viam C++ SDK.
 
const char * viam::sdk::default_module_name ()
 Returns the default "channel name" of log messages related to a Viam C++ module.
 

Detailed Description

Macro Definition Documentation

◆ VIAM_MODULE_LOG

#define VIAM_MODULE_LOG ( level)     VIAM_SDK_LOG_IMPL(::viam::sdk::LogManager::get().module_logger(), level)

Log macro for logs related to a module.

Use this macro to generate log messages pertaining to a Viam C++ module.

See also
viam::sdk::LogManager::set_module_name and viam::sdk::LogManager::set_module_log_level.

◆ VIAM_RESOURCE_LOG

#define VIAM_RESOURCE_LOG ( ...)
Value:
BOOST_PP_CAT(BOOST_PP_OVERLOAD(VIAM_RESOURCE_LOG_IMPL_, __VA_ARGS__)(__VA_ARGS__), \
BOOST_PP_EMPTY())

Log macro for resource-level logs, allowing resource-level filtering.

This macro can be called like VIAM_RESOURCE_LOG(resource, level) to associate log messages with resource, or, as a particular case, VIAM_RESOURCE_LOG(*this, level) from within a member function definition.

Remarks
For compatiblity with earlier SDK versions, calling with a single argument as in VIAM_RESOURCE_LOG(level) will log as if by VIAM_RESOURCE_LOG(*this, level).
See also
viam::sdk::Resource::set_log_level.

◆ VIAM_SDK_LOG

#define VIAM_SDK_LOG ( level)    VIAM_SDK_LOG_IMPL(::viam::sdk::LogManager::get().global_logger(), level)

Log macro for general SDK logs.

Use this macro to generate log messages pertaining to the SDK at large.

See also
viam::sdk::LogManager::set_global_resource_name and viam::sdk::LogManager::set_global_log_level.

Typedef Documentation

◆ LogSource

using viam::sdk::LogSource = boost::log::sources::severity_channel_logger_mt<log_level>

Type alias for the log source in the C++ SDK.

In the paradigm of Boost.Log the C++ SDK has precisely one logging source, namely the source of messages generated by the user invoking one of the logging macros.

Enumeration Type Documentation

◆ log_level

enum class viam::sdk::log_level : std::int8_t
strong

Severity levels for the logger.

Remarks
Our enums are usually prefixed with k_, but these values are meant to be used without namespace qualification in the log macros, eg VIAM_SDK_LOG(info) instead of VIAM_SDK_LOG(k_info).