Class Logger
Defined in File logger.hpp
Class Documentation
-
class Logger
Public Types
Public Functions
-
inline const char *get_name() const
Get the name of this logger.
- Returns:
the full name of the logger including any prefixes, or
- Returns:
nullptr
if this logger is invalid (e.g. because logging is disabled).
-
Logger get_child(const std::string &suffix)
Return a logger that is a descendant of this logger.
The child logger’s full name will include any hierarchy conventions that indicate it is a descendant of this logger. For example,
get_logger('abc').get_child('def')
will return a logger with nameabc.def
.- Parameters:
suffix – [in] the child logger’s suffix
- Returns:
a logger with the fully-qualified name including the suffix, or
- Returns:
a dummy logger if this logger is invalid (e.g. because logging is disabled).
-
void set_level(Level level)
Set level for current logger.
- Parameters:
level – [in] the logger’s level
- Throws:
rclcpp::exceptions::RCLInvalidArgument – if level is invalid.
rclcpp::exceptions::RCLError – if other error happens.
-
Level get_effective_level() const
Get effective level for current logger.
The effective level is determined as the severity level of the logger if it is set, otherwise it is the first specified severity level of the logger’s ancestors, starting with its closest ancestor. The ancestor hierarchy is signified by logger names being separated by dots: a logger named
x
is an ancestor ofx.y
, and bothx
andx.y
are ancestors ofx.y.z
, etc. If the level has not been set for the logger nor any of its ancestors, the default level is used.- Throws:
rclcpp::exceptions::RCLError – if any error happens.
- Returns:
Level for the current logger.
-
inline const char *get_name() const