Skip to content

Commit 2531787

Browse files
codebotclalancette
andauthored
Include topic name in QoS mismatch warning messages (#1286)
* Include topic name in QoS mismatch warning messages Signed-off-by: Morgan Quigley <[email protected]> Co-authored-by: Chris Lalancette <[email protected]>
1 parent 974772e commit 2531787

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

rclcpp/src/rclcpp/publisher_base.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ PublisherBase::default_incompatible_qos_callback(
262262
std::string policy_name = qos_policy_name_from_kind(event.last_policy_kind);
263263
RCLCPP_WARN(
264264
rclcpp::get_logger(rcl_node_get_logger_name(rcl_node_handle_.get())),
265-
"New subscription discovered on this topic, requesting incompatible QoS. "
265+
"New subscription discovered on topic '%s', requesting incompatible QoS. "
266266
"No messages will be sent to it. "
267-
"Last incompatible policy: %s", policy_name.c_str());
267+
"Last incompatible policy: %s",
268+
get_topic_name(),
269+
policy_name.c_str());
268270
}

rclcpp/src/rclcpp/subscription_base.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,11 @@ SubscriptionBase::default_incompatible_qos_callback(
245245
std::string policy_name = qos_policy_name_from_kind(event.last_policy_kind);
246246
RCLCPP_WARN(
247247
rclcpp::get_logger(rcl_node_get_logger_name(node_handle_.get())),
248-
"New publisher discovered on this topic, offering incompatible QoS. "
248+
"New publisher discovered on topic '%s', offering incompatible QoS. "
249249
"No messages will be sent to it. "
250-
"Last incompatible policy: %s", policy_name.c_str());
250+
"Last incompatible policy: %s",
251+
get_topic_name(),
252+
policy_name.c_str());
251253
}
252254

253255
bool

rclcpp/test/rclcpp/test_qos_event.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ TEST_F(TestQosEvent, test_default_incompatible_qos_callbacks)
211211

212212
if (!is_fastrtps) {
213213
EXPECT_EQ(
214-
"New subscription discovered on this topic, requesting incompatible QoS. "
214+
"New subscription discovered on topic '/ns/test_topic', requesting incompatible QoS. "
215215
"No messages will be sent to it. Last incompatible policy: DURABILITY_QOS_POLICY",
216216
pub_log_msg);
217217
EXPECT_EQ(
218-
"New publisher discovered on this topic, offering incompatible QoS. "
218+
"New publisher discovered on topic '/ns/test_topic', offering incompatible QoS. "
219219
"No messages will be sent to it. Last incompatible policy: DURABILITY_QOS_POLICY",
220220
sub_log_msg);
221221
}

0 commit comments

Comments
 (0)