rclcpp  master
C++ ROS Client Library API
Public Types | Public Member Functions | Friends | List of all members
rclcpp::Logger Class Reference

#include <logger.hpp>

Public Types

enum  Level {
  Level::Unset = RCUTILS_LOG_SEVERITY_UNSET, Level::Debug = RCUTILS_LOG_SEVERITY_DEBUG, Level::Info = RCUTILS_LOG_SEVERITY_INFO, Level::Warn = RCUTILS_LOG_SEVERITY_WARN,
  Level::Error = RCUTILS_LOG_SEVERITY_ERROR, Level::Fatal = RCUTILS_LOG_SEVERITY_FATAL
}
 An enum for the type of logger level. More...
 

Public Member Functions

 Logger (const Logger &)=default
 
const char * get_name () const
 Get the name of this logger. More...
 
Logger get_child (const std::string &suffix)
 Return a logger that is a descendant of this logger. More...
 
void set_level (Level level)
 Set level for current logger. More...
 

Friends

Logger rclcpp::get_logger (const std::string &name)
 

Member Enumeration Documentation

◆ Level

enum rclcpp::Logger::Level
strong

An enum for the type of logger level.

Enumerator
Unset 

The unset log level.

Debug 

The debug log level.

Info 

The info log level.

Warn 

The warn log level.

Error 

The error log level.

Fatal 

The fatal log level.

Constructor & Destructor Documentation

◆ Logger()

rclcpp::Logger::Logger ( const Logger )
default

Member Function Documentation

◆ get_name()

const char* rclcpp::Logger::get_name ( ) const
inline

Get the name of this logger.

Returns
the full name of the logger including any prefixes, or
nullptr if this logger is invalid (e.g. because logging is disabled).

◆ get_child()

Logger rclcpp::Logger::get_child ( const std::string suffix)
inline

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 name abc.def.

Parameters
[in]suffixthe child logger's suffix
Returns
a logger with the fully-qualified name including the suffix, or
a dummy logger if this logger is invalid (e.g. because logging is disabled).

◆ set_level()

void rclcpp::Logger::set_level ( Level  level)

Set level for current logger.

Parameters
[in]levelthe logger's level
Exceptions
rclcpp::exceptions::RCLInvalidArgumentif level is invalid.
rclcpp::exceptions::RCLErrorif other error happens.

Friends And Related Function Documentation

◆ rclcpp::get_logger

Logger rclcpp::get_logger ( const std::string name)
friend

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