예제 #1
0
std::string TraceEvent::toString() const {
  std::ostringstream out;
  int startSinceEpoch = std::chrono::duration_cast<std::chrono::milliseconds>(
    start_.time_since_epoch()).count();
  int endSinceEpoch = std::chrono::duration_cast<std::chrono::milliseconds>(
    end_.time_since_epoch()).count();
  out << "TraceEvent(";
  out << "type='" << getTraceEventTypeString(type_) << "', ";
  out << "id='" << id_ << "', ";
  out << "parentID='" << parentID_ << "', ";
  out << "start='" << startSinceEpoch << "', ";
  out << "end='" << endSinceEpoch << "', ";
  out << "metaData='{";
  for (auto data : metaData_) {
    out << getTraceFieldTypeString(data.first) << ": "
        << folly::convertTo<std::string>(data.second) << ", ";
  }
  out << "}')";
  return out.str();
}
예제 #2
0
std::string TraceEvent::toString() const {
  std::ostringstream out;
  int startSinceEpoch = std::chrono::duration_cast<std::chrono::milliseconds>(
    start_.time_since_epoch()).count();
  int endSinceEpoch = std::chrono::duration_cast<std::chrono::milliseconds>(
    end_.time_since_epoch()).count();
  out << "TraceEvent(";
  out << "type='" << getTraceEventTypeString(type_) << "', ";
  out << "id='" << id_ << "', ";
  out << "parentID='" << parentID_ << "', ";
  out << "start='" << startSinceEpoch << "', ";
  out << "end='" << endSinceEpoch << "', ";
  out << "metaData='{";
  auto itr = getMetaDataItr();
  while (itr.isValid()) {
    out << getTraceFieldTypeString(itr.getKey()) << ": "
        << itr.getValueAs<std::string>() << ", ";
    itr.next();
  }
  out << "}')";
  return out.str();
}
예제 #3
0
  // Helpers used to make TraceEventType/TraceFieldType can be used with GLOG
std::ostream& operator<<(std::ostream& os, TraceEventType eventType) {
  os << getTraceEventTypeString(eventType);
  return os;
}