Ejemplo n.º 1
0
string wbLogger_toJSON(wbLogger_t logger) {
  if (logger != NULL) {
    wbLogEntry_t iter;
    stringstream ss;

    for (iter = wbLogger_getHead(logger); iter != NULL;
         iter = wbLogEntry_getNext(iter)) {
      ss << wbLogEntry_toJSON(iter);
      if (wbLogEntry_getNext(iter) != NULL) {
        ss << ",\n";
      }
    }

    return ss.str();
  }
  return "";
}
Ejemplo n.º 2
0
string wbLogger_toJSON(wbLogger_t logger) {
  if (logger != NULL) {
    wbLogEntry_t iter;
    stringstream ss;

    ss << "{\n";
    ss << wbString_quote("elements") << ":[\n";
    for (iter = wbLogger_getHead(logger); iter != NULL;
         iter = wbLogEntry_getNext(iter)) {
      ss << wbLogEntry_toJSON(iter);
      if (wbLogEntry_getNext(iter) != NULL) {
        ss << ",\n";
      }
    }
    ss << "]\n";
    ss << "}\n";

    return ss.str();
  }
  return "";
}