Fawkes API
Fawkes Development Version
|
21 #include "print_action_executor.h"
25 #include <logging/logger.h>
50 return activity->mapped_name() ==
"print";
57 throw Exception(
"Cannot execute activity '%s' with PrintActionExecutor",
58 activity->mapped_name().c_str());
60 activity->update(gologpp::Transition::Hook::START);
61 std::map<std::string, Logger::LogLevel> log_levels = {{
"debug",
Logger::LL_DEBUG},
67 if (activity->target()->mapping().arg_mapping().count(
"level") > 0) {
68 std::string level_str =
static_cast<std::string
>(activity->mapped_arg_value(
"level"));
69 if (log_levels.count(level_str) > 0) {
70 log_level = log_levels[level_str];
77 static_cast<std::string
>(activity->mapped_arg_value(
"message")).c_str());
78 activity->update(gologpp::Transition::Hook::FINISH);
84 logger_->
log_error(
"PrintActionExecutor",
"Cannot stop printing a message!");
virtual void log(LogLevel level, const char *component, const char *format,...)
Log message of given log level.
void start(std::shared_ptr< gologpp::Activity > activity) override
Start the given activity.
bool can_execute_activity(std::shared_ptr< gologpp::Activity > activity) const override
Determine if this executor can execute the given activity.
virtual ~PrintActionExecutor()
Destructor.
@ LL_DEBUG
debug output, relevant only when tracking down problems
virtual void log_error(const char *component, const char *format,...)=0
Log error message.
@ LL_INFO
informational output about normal procedures
Fawkes library namespace.
PrintActionExecutor(Logger *logger)
Constructor.
@ LL_ERROR
error, may be recoverable (software still running) or not (software has to terminate).
Logger * logger_
The logger to use for logging messages.
void stop(std::shared_ptr< gologpp::Grounding< gologpp::Action >> activity) override
Stop the given activity.
@ LL_NONE
use this to disable log output
@ LL_WARN
warning, should be investigated but software still functions, an example is that something was reques...
Abstract class to execute a Golog++ activity.
Base class for exceptions in Fawkes.