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_RESOURCE_LOG(level)   VIAM_SDK_LOG_IMPL(this->logger_, level)
 Log macro for resource-level logs.
 

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 not originating from resources.
 

Detailed Description

Macro Definition Documentation

◆ VIAM_RESOURCE_LOG

#define VIAM_RESOURCE_LOG ( level)    VIAM_SDK_LOG_IMPL(this->logger_, level)

Log macro for resource-level logs.

This macro can only be called from the definition of a member function of a class inheriting Resource. It will log messages to the log source of that specific resource, allowing resource-level log filtering.

◆ 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.

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).