const std::string LogNode::FormatLogs()

in cloudwatch_logger/src/log_node.cpp [111:154]


const std::string LogNode::FormatLogs(const rosgraph_msgs::Log::ConstPtr & log_msg)
{
  std::stringstream ss;
  ss << log_msg->header.stamp << " ";

  switch (log_msg->level) {
    case rosgraph_msgs::Log::FATAL:
      ss << "FATAL ";
      break;
    case rosgraph_msgs::Log::ERROR:
      ss << "ERROR ";
      break;
    case rosgraph_msgs::Log::WARN:
      ss << "WARN ";
      break;
    case rosgraph_msgs::Log::DEBUG:
      ss << "DEBUG ";
      break;
    case rosgraph_msgs::Log::INFO:
      ss << "INFO ";
      break;
    default:
      ss << log_msg->level << " ";
  }
  ss << "[node name: " << log_msg->name << "] ";

  if (publish_topic_names_) {
    ss << "[topics: ";
    auto it = log_msg->topics.begin();
    auto end = log_msg->topics.end();
    for (; it != end; ++it) {
      const std::string & topic = *it;
      if (it != log_msg->topics.begin()) {
        ss << ", ";
      }
      ss << topic;
    }
    ss  << "] ";
  }

  ss << log_msg->msg << "\n";

  return ss.str();
}