Skip to content

Commit

Permalink
Merge pull request #1340 from tier4/hotfix-add-system-error-log
Browse files Browse the repository at this point in the history
chore(topic_state_monitor): enrich error log message (autowarefoundation#7236)
  • Loading branch information
TakaHoribe authored Jun 19, 2024
2 parents 6a72280 + dd49e8c commit 87156a0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions system/topic_state_monitor/src/topic_state_monitor_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ void TopicStateMonitorNode::checkTopicStatus(diagnostic_updater::DiagnosticStatu
const auto print_warn = [&](const std::string & msg) {
RCLCPP_WARN_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
};
const auto print_debug = [&](const std::string & msg) {
RCLCPP_DEBUG_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
const auto print_info = [&](const std::string & msg) {
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
};

// Judge level
Expand All @@ -166,19 +166,21 @@ void TopicStateMonitorNode::checkTopicStatus(diagnostic_updater::DiagnosticStatu
} else if (topic_status == TopicStatus::NotReceived) {
level = DiagnosticStatus::ERROR;
stat.add("status", "NotReceived");
print_debug(node_param_.topic + " has not received.");
print_info(node_param_.topic + " has not received. Set ERROR in diagnostics.");
} else if (topic_status == TopicStatus::WarnRate) {
level = DiagnosticStatus::WARN;
stat.add("status", "WarnRate");
print_warn(node_param_.topic + " topic rate has dropped to the warning level.");
print_warn(
node_param_.topic + " topic rate has dropped to the warning level. Set WARN in diagnostics.");
} else if (topic_status == TopicStatus::ErrorRate) {
level = DiagnosticStatus::ERROR;
stat.add("status", "ErrorRate");
print_warn(node_param_.topic + " topic rate has dropped to the error level.");
print_warn(
node_param_.topic + " topic rate has dropped to the error level. Set ERROR in diagnostics.");
} else if (topic_status == TopicStatus::Timeout) {
level = DiagnosticStatus::ERROR;
stat.add("status", "Timeout");
print_warn(node_param_.topic + " topic is timeout.");
print_warn(node_param_.topic + " topic is timeout. Set ERROR in diagnostics.");
}

// Add key-value
Expand Down

0 comments on commit 87156a0

Please sign in to comment.