From 3a4d62eb554c8fb99ad4a73e37aa89b23f6a77b0 Mon Sep 17 00:00:00 2001 From: Ferry Schoenmakers Date: Tue, 18 Jun 2024 14:09:53 +0200 Subject: [PATCH 1/3] Stop flooding the terminal by default with all matches, switch to debug if desired --- .../diagnostic_aggregator/generic_analyzer_base.hpp | 2 +- diagnostic_aggregator/src/analyzer_group.cpp | 10 +++++----- diagnostic_aggregator/src/generic_analyzer.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp b/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp index d7cb8a485..5b8b8c1b4 100644 --- a/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp +++ b/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp @@ -119,7 +119,7 @@ class GenericAnalyzerBase : public Analyzer has_initialized_ = true; - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzerBase"), "Initialized analyzer '%s' with path '%s' and breadcrumb '%s'.", nice_name_.c_str(), path_.c_str(), breadcrumb_.c_str()); diff --git a/diagnostic_aggregator/src/analyzer_group.cpp b/diagnostic_aggregator/src/analyzer_group.cpp index d54a70d39..b1d0425a7 100644 --- a/diagnostic_aggregator/src/analyzer_group.cpp +++ b/diagnostic_aggregator/src/analyzer_group.cpp @@ -74,7 +74,7 @@ bool AnalyzerGroup::init( breadcrumb_.c_str(), n->get_namespace()); return false; } - RCLCPP_INFO( + RCLCPP_DEBUG( logger_, "Retrieved %zu parameter(s) for analyzer group with prefix '%s'.", parameters.size(), breadcrumb_.c_str()); @@ -112,7 +112,7 @@ bool AnalyzerGroup::init( } if (!ns.empty() && !an_type.empty() && !an_path.empty()) { - RCLCPP_INFO( + RCLCPP_DEBUG( logger_, "Group '%s', creating %s '%s' (breadcrumb: %s) ...", nice_name_.c_str(), an_type.c_str(), an_path.c_str(), ns.c_str()); @@ -175,7 +175,7 @@ bool AnalyzerGroup::init( init_ok = false; RCLCPP_ERROR(logger_, "No analyzers initialized in AnalyzerGroup '%s'", n->get_namespace()); } else { - RCLCPP_INFO( + RCLCPP_DEBUG( logger_, "Initialized analyzer group '%s' with path '%s' and breadcrumb '%s'.", nice_name_.c_str(), path_.c_str(), breadcrumb_.c_str()); } @@ -191,7 +191,7 @@ AnalyzerGroup::~AnalyzerGroup() bool AnalyzerGroup::addAnalyzer(std::shared_ptr & analyzer) { - RCLCPP_INFO( + RCLCPP_DEBUG( logger_, "Adding analyzer '%s' to group '%s'.", analyzer->getName().c_str(), nice_name_.c_str()); analyzers_.push_back(analyzer); @@ -238,7 +238,7 @@ bool AnalyzerGroup::match(const std::string & name) match_name = mtch || match_name; matched_[name].at(i) = mtch; if (mtch) { - RCLCPP_INFO( + RCLCPP_DEBUG( logger_, "Group '%s' has a match with my analyzer '%s'.", nice_name_.c_str(), analyzers_[i]->getName().c_str()); } diff --git a/diagnostic_aggregator/src/generic_analyzer.cpp b/diagnostic_aggregator/src/generic_analyzer.cpp index 6fa8efddd..3965b226d 100644 --- a/diagnostic_aggregator/src/generic_analyzer.cpp +++ b/diagnostic_aggregator/src/generic_analyzer.cpp @@ -192,7 +192,7 @@ bool GenericAnalyzer::match(const string & name) std::cmatch what; for (unsigned int i = 0; i < regex_.size(); ++i) { if (std::regex_match(name.c_str(), what, regex_[i])) { - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzer"), "Analyzer '%s' matches '%s' with regex.", nice_name_.c_str(), name.c_str()); return true; @@ -201,7 +201,7 @@ bool GenericAnalyzer::match(const string & name) for (unsigned int i = 0; i < expected_.size(); ++i) { if (name == expected_[i]) { - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzer"), "Analyzer '%s' matches '%s'.", nice_name_.c_str(), name.c_str()); return true; @@ -210,7 +210,7 @@ bool GenericAnalyzer::match(const string & name) for (unsigned int i = 0; i < name_.size(); ++i) { if (name == name_[i]) { - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzer"), "Analyzer '%s' matches '%s'.", nice_name_.c_str(), name.c_str()); return true; @@ -219,7 +219,7 @@ bool GenericAnalyzer::match(const string & name) for (unsigned int i = 0; i < startswith_.size(); ++i) { if (name.find(startswith_[i]) == 0) { - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzer"), "Analyzer '%s' matches '%s'.", nice_name_.c_str(), name.c_str()); return true; @@ -228,7 +228,7 @@ bool GenericAnalyzer::match(const string & name) for (unsigned int i = 0; i < contains_.size(); ++i) { if (name.find(contains_[i]) != string::npos) { - RCLCPP_INFO( + RCLCPP_DEBUG( rclcpp::get_logger("GenericAnalyzer"), "Analyzer '%s' matches '%s'.", nice_name_.c_str(), name.c_str()); return true; From 7d3472719109b247d85c263495fc2708959782ce Mon Sep 17 00:00:00 2001 From: Ferry Schoenmakers Date: Tue, 18 Jun 2024 14:36:03 +0200 Subject: [PATCH 2/3] Enable debug logging for testing to parse stdout --- diagnostic_aggregator/test/create_analyzers.launch.py.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/diagnostic_aggregator/test/create_analyzers.launch.py.in b/diagnostic_aggregator/test/create_analyzers.launch.py.in index b998aadda..7d36c1e6a 100644 --- a/diagnostic_aggregator/test/create_analyzers.launch.py.in +++ b/diagnostic_aggregator/test/create_analyzers.launch.py.in @@ -23,7 +23,9 @@ def generate_test_description(): "@AGGREGATOR_NODE@", "--ros-args", "--params-file", - "@PARAMETER_FILE@" + "@PARAMETER_FILE@", + "--log-level", + "DEBUG" ], name='aggregator_node', emulate_tty=True, From 86bb7869b9357a74456842cf5659b64e02180cec Mon Sep 17 00:00:00 2001 From: Ferry Schoenmakers Date: Tue, 18 Jun 2024 14:48:04 +0200 Subject: [PATCH 3/3] Here also... --- diagnostic_aggregator/test/add_analyzers.launch.py.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/diagnostic_aggregator/test/add_analyzers.launch.py.in b/diagnostic_aggregator/test/add_analyzers.launch.py.in index 8e4eae8da..ff014715c 100644 --- a/diagnostic_aggregator/test/add_analyzers.launch.py.in +++ b/diagnostic_aggregator/test/add_analyzers.launch.py.in @@ -23,7 +23,9 @@ def generate_test_description(): "@AGGREGATOR_NODE@", "--ros-args", "--params-file", - "@PARAMETER_FILE@" + "@PARAMETER_FILE@", + "--log-level", + "DEBUG" ], name='aggregator_node', emulate_tty=True, @@ -34,7 +36,9 @@ def generate_test_description(): "@ADD_ANALYZER@", "--ros-args", "--params-file", - "@ADD_PARAMETER_FILE@" + "@ADD_PARAMETER_FILE@", + "--log-level", + "DEBUG" ], name='add_analyzer', emulate_tty=True,