Base class to allow Behaviors to report messages with detailed explanations to MoveIt Studio UI.
More...
#include <logger.hpp>
|
| 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.
|
| |
| std::shared_ptr< void > | pushFilter (LogFilter filter) |
| | Push a filter onto the active filter stack.
|
| |
|
| 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.
|
| |
Base class to allow Behaviors to report messages with detailed explanations to MoveIt Studio UI.
◆ LogFilter
A filter invoked for every message published through this logger.
- Parameters
-
| log_level | The severity of the message (moveit_studio_agent_msgs::msg::Log::ERROR/WARN/INFO). |
| details | The fully-formatted message text (including the source name and level string). |
- Returns
- Forward to publish the message normally, or Drop to suppress it entirely.
◆ LogFilterAction
Action a LogFilter returns to tell the logger how to handle a message.
The filter is consulted on the public publishMessage funnel, before the message is dispatched to the virtual publish path. Drop suppresses the message entirely (no console, no error buffer, no ROS topic, and so no UI toast); Forward leaves the message untouched and publishes it as if no filter were installed.
◆ ~LoggerBase()
| virtual moveit_pro::behavior::LoggerBase::~LoggerBase |
( |
| ) |
|
|
virtualdefault |
◆ 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_name | Name used to identify the source of the failure. |
| details | A 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_name | Name used to identify the source of the info. |
| details | A 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_level | moveit_studio_agent_msgs::msg::ERROR/WARN/INFO |
| details | Contains 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_level | moveit_studio_agent_msgs::msg::ERROR/WARN/INFO |
| source_name | Name used to identify the source of the log. |
| details | Contains 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_name | Name used to identify the source of the warning. |
| details | A detailed message describing the warning. |
◆ pushFilter()
| std::shared_ptr< void > moveit_pro::behavior::LoggerBase::pushFilter |
( |
LogFilter |
filter | ) |
|
Push a filter onto the active filter stack.
The returned RAII token pops this filter (under the filter mutex) when it is destroyed. Only the top (most recently pushed) filter is consulted per message — there is no fallthrough from a Forward to the filters beneath it; while an inner filter is installed, the outer ones are dormant. In the normal single-filter case this is moot. If filters are nested (e.g. nested SuppressChildErrors decorators), only the innermost filter's decision applies to messages logged while it is on top. Thread-safe.
- Parameters
-
| filter | The filter to install. Must not be empty. |
- Returns
- An opaque ownership token. Reset or destroy it to remove the filter.
The documentation for this class was generated from the following files: