Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
logging.hpp File Reference

Defines logging infrastructure. More...

#include <cstdint>
#include <map>
#include <memory>
#include <ostream>
#include <boost/log/attributes/clock.hpp>
#include <boost/log/expressions/keyword.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/log/sources/severity_channel_logger.hpp>
#include <boost/log/utility/manipulators/add_value.hpp>
#include <boost/utility/string_view.hpp>

Go to the source code of this file.

Classes

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

Macros

#define VIAM_SDK_LOG_IMPL(lg, level)
 
#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

std::string viam::sdk::to_string (log_level)
 
log_level viam::sdk::level_from_string (std::string level)
 
std::ostream & viam::sdk::operator<< (std::ostream &, log_level)
 
const char * viam::sdk::global_resource_name ()
 Returns the "channel name" of general log messages not originating from resources.
 
boost::string_view viam::sdk::log_detail::trim_filename (const char *file)
 
 viam::sdk::BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE (attr_channel, "Channel", std::string)
 
 viam::sdk::BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE (attr_sev, "Severity", viam::sdk::log_level)
 
 viam::sdk::BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE (attr_file, "file", boost::string_view)
 
 viam::sdk::BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE (attr_line, "line", unsigned int)
 
 viam::sdk::BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE (attr_time, "TimeStamp", boost::log::attributes::local_clock::value_type)
 

Detailed Description

Defines logging infrastructure.

Macro Definition Documentation

◆ VIAM_SDK_LOG_IMPL

#define VIAM_SDK_LOG_IMPL ( lg,
level )
Value:
BOOST_LOG_SEV((lg), ::viam::sdk::log_level::level) \
<< ::boost::log::add_value(::viam::sdk::attr_file_type{}, \
::viam::sdk::log_detail::trim_filename(__FILE__)) \
<< ::boost::log::add_value(::viam::sdk::attr_line_type{}, __LINE__)