15 #ifndef RCLCPP__LOGGER_HPP_
16 #define RCLCPP__LOGGER_HPP_
23 #include "rclcpp/visibility_control.hpp"
26 #include "rcutils/logging.h"
27 #include "rcpputils/filesystem_helper.hpp"
39 #ifndef RCLCPP_LOGGING_ENABLED
40 #define RCLCPP_LOGGING_ENABLED 1
47 namespace node_interfaces
83 # pragma GCC diagnostic push
84 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
86 # pragma warning(push)
87 # pragma warning(disable: 4996)
97 [[deprecated(
"use rclcpp::get_log_directory instead of rclcpp::get_logging_directory")]]
104 # pragma GCC diagnostic pop
106 # pragma warning(pop)
118 std::filesystem::path
127 Unset = RCUTILS_LOG_SEVERITY_UNSET,
128 Debug = RCUTILS_LOG_SEVERITY_DEBUG,
129 Info = RCUTILS_LOG_SEVERITY_INFO,
130 Warn = RCUTILS_LOG_SEVERITY_WARN,
131 Error = RCUTILS_LOG_SEVERITY_ERROR,
132 Fatal = RCUTILS_LOG_SEVERITY_FATAL,
137 friend ::rclcpp::node_interfaces::NodeLogging;
151 explicit Logger(
const std::string & name)
152 : name_(new std::string(name)) {}
154 std::shared_ptr<const std::string> name_;
155 std::shared_ptr<std::pair<std::string, std::string>> logger_sublogger_pairname_ =
nullptr;
171 return name_->c_str();
RCLCPP_PUBLIC void set_level(Level level)
Set level for current logger.
RCLCPP_PUBLIC Logger get_child(const std::string &suffix)
Return a logger that is a descendant of this logger.
RCLCPP_PUBLIC const char * get_name() const
Get the name of this logger.
RCLCPP_PUBLIC Level get_effective_level() const
Get effective level for current logger.
Level
An enum for the type of logger level.
@ Info
The info log level.
@ Warn
The warn log level.
@ Fatal
The fatal log level.
@ Error
The error log level.
@ Debug
The debug log level.
@ Unset
The unset log level.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
RCLCPP_PUBLIC Logger get_node_logger(const rcl_node_t *node)
Return a named logger using an rcl_node_t.
RCLCPP_PUBLIC std::filesystem::path get_log_directory()
Get the current logging directory.
RCLCPP_PUBLIC rcpputils::fs::path get_logging_directory()
Get the current logging directory.
RCLCPP_PUBLIC Logger get_logger(const std::string &name)
Return a named logger.
Structure which encapsulates a ROS Node.