diff --git a/rclcpp/resource/logging.hpp.em b/rclcpp/resource/logging.hpp.em index 3e99619c79..9036d9a830 100644 --- a/rclcpp/resource/logging.hpp.em +++ b/rclcpp/resource/logging.hpp.em @@ -149,7 +149,7 @@ def get_rclcpp_suffix_from_features(features): @[ if params]@ @(''.join([' ' + p + ', \\\n' for p in params if p != stream_arg]))@ @[ end if]@ - logger.get_name(), \ + (logger).get_name(), \ @[ if 'stream' not in feature_combination]@ rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \ RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \ diff --git a/rclcpp/test/rclcpp/test_logging.cpp b/rclcpp/test/rclcpp/test_logging.cpp index 87e93f9fe3..4dbb6bdd3a 100644 --- a/rclcpp/test/rclcpp/test_logging.cpp +++ b/rclcpp/test/rclcpp/test_logging.cpp @@ -249,6 +249,12 @@ TEST_F(TestLoggingMacros, test_throttle) { } } +TEST_F(TestLoggingMacros, test_parameter_expression) { + RCLCPP_DEBUG_STREAM(*&g_logger, "message"); + EXPECT_EQ(1u, g_log_calls); + EXPECT_EQ("message", g_last_log_event.message); +} + bool log_function(rclcpp::Logger logger) { RCLCPP_INFO(logger, "successful log");