Hey, Jeff. I actually stumbled across the answer to this not too long ago. When you use logging macros in ROS2, the first argument is an rclcpp::Logger
which you would normally get from calling get_logger()
on an rclcpp::Node
. However, the rclcpp
namespace also provides a get_logger()
function which can be used to generate an rclcpp::Logger
without a node instance by just giving it a name. I believe the only difference between this type of rclcpp::Logger
instance and the one you would get from a node is the logger maintaining a reference to the node and changing its name if the node name changes.
Originally posted by Josh Whitley with karma: 1766 on 2020-09-15
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Jeffrey Kane Johnson on 2020-09-16:
Perfect, thanks!
Comment by dannee on 2022-09-19:
If anyone is looking for the python answer, it can be called with: rclpy.logging.get_logger(name)