From dd1185c815b570159513cfa925d0e1392e138e27 Mon Sep 17 00:00:00 2001 From: Juan Lopez Fernandez Date: Wed, 4 Sep 2024 15:54:06 +0200 Subject: [PATCH] BONUS: improve participant discovery traces Signed-off-by: Juan Lopez Fernandez --- .../cpp/participant/dds/CommonParticipant.cpp | 31 +++++++++++------ .../participant/rtps/CommonParticipant.cpp | 33 +++++++++++++------ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index a6b8817c..ec65d088 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -230,19 +230,24 @@ void CommonParticipant::on_participant_discovery( } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << + " changed QoS."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " removed."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " dropped."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " ignored."); } } } @@ -275,20 +280,23 @@ void CommonParticipant::on_data_reader_discovery( } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -322,20 +330,23 @@ void CommonParticipant::on_data_writer_discovery( } else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 7d512abb..88d339ff 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -94,19 +94,24 @@ void CommonParticipant::on_participant_discovery( } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << + " changed QoS."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " removed."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " dropped."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " ignored."); } } } @@ -132,20 +137,24 @@ void CommonParticipant::on_reader_discovery( } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << + " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -173,20 +182,24 @@ void CommonParticipant::on_writer_discovery( } else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << + " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) }