MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behavior::LoggerBase Class Reference

Base class to allow Behaviors to report messages with detailed explanations to MoveIt Studio UI. More...

#include <logger.hpp>

Inheritance diagram for moveit_pro::behavior::LoggerBase:

Public Member Functions

virtual ~LoggerBase ()=default
 
void publishFailureMessage (const std::string &error_source_name, const std::string &details="")
 Helper function that wraps publishMessage with a preset ERROR log level.
 
void publishWarnMessage (const std::string &source_name, const std::string &details="")
 Helper function that wraps publishMessage with a preset WARN log level.
 
void publishInfoMessage (const std::string &source_name, const std::string &details="")
 Helper function that wraps publishMessage with a preset INFO log level.
 
void publishMessage (const int32_t log_level, const std::string &source_name, const std::string &details)
 Function to publish a message.
 
virtual std::string consumeErrorLogBuffer ()
 Helper function to get the error log buffer.
 

Protected Member Functions

virtual void publishMessage (const int32_t log_level, const std::string &details)
 Function to publish a message. The default implementation logs to spdlog. LoggerROS is a good example of a subclass that overrides this, in which it publishes the message to a ROS topic and also calls this superclass function to also log to console.
 

Detailed Description

Base class to allow Behaviors to report messages with detailed explanations to MoveIt Studio UI.

Constructor & Destructor Documentation

◆ ~LoggerBase()

virtual moveit_pro::behavior::LoggerBase::~LoggerBase ( )
virtualdefault

Member Function Documentation

◆ consumeErrorLogBuffer()

std::string moveit_pro::behavior::LoggerBase::consumeErrorLogBuffer ( )
virtual

Helper function to get the error log buffer.

Returns
A string containing all the error logs in the buffer, separated by new lines
Note
This function clears out the logs once retrieved

◆ publishFailureMessage()

void moveit_pro::behavior::LoggerBase::publishFailureMessage ( const std::string &  error_source_name,
const std::string &  details = "" 
)

Helper function that wraps publishMessage with a preset ERROR log level.

Parameters
error_source_nameName used to identify the source of the failure.
detailsA detailed message describing the failure. For example, the contents of an exception's message.

◆ publishInfoMessage()

void moveit_pro::behavior::LoggerBase::publishInfoMessage ( const std::string &  source_name,
const std::string &  details = "" 
)

Helper function that wraps publishMessage with a preset INFO log level.

Parameters
source_nameName used to identify the source of the info.
detailsA detailed message describing the information.

◆ publishMessage() [1/2]

void moveit_pro::behavior::LoggerBase::publishMessage ( const int32_t  log_level,
const std::string &  details 
)
protectedvirtual

Function to publish a message. The default implementation logs to spdlog. LoggerROS is a good example of a subclass that overrides this, in which it publishes the message to a ROS topic and also calls this superclass function to also log to console.

Parameters
log_levelmoveit_studio_agent_msgs::msg::ERROR/WARN/INFO
detailsContains the information message

Reimplemented in moveit_pro::behavior::LoggerROS, and moveit_pro::behavior::LoggerROS.

◆ publishMessage() [2/2]

void moveit_pro::behavior::LoggerBase::publishMessage ( const int32_t  log_level,
const std::string &  source_name,
const std::string &  details 
)

Function to publish a message.

Parameters
log_levelmoveit_studio_agent_msgs::msg::ERROR/WARN/INFO
source_nameName used to identify the source of the log.
detailsContains the information message

◆ publishWarnMessage()

void moveit_pro::behavior::LoggerBase::publishWarnMessage ( const std::string &  source_name,
const std::string &  details = "" 
)

Helper function that wraps publishMessage with a preset WARN log level.

Parameters
source_nameName used to identify the source of the warning.
detailsA detailed message describing the warning.

The documentation for this class was generated from the following files: