| 52 | } |
| 53 | |
| 54 | void PrintErrorMap(ostream* stream, const ErrorLogMap& errors) { |
| 55 | for (const ErrorLogMap::value_type& v: errors) { |
| 56 | const ErrorLogEntryPB& entry = v.second; |
| 57 | if (v.first == TErrorCode::GENERAL) { |
| 58 | DCHECK_EQ(entry.count(), 0); |
| 59 | for (auto& msg : entry.messages()) { |
| 60 | *stream << msg << "\n"; |
| 61 | } |
| 62 | } else if (entry.messages_size() > 0) { |
| 63 | DCHECK_GT(entry.count(), 0); |
| 64 | DCHECK_EQ(entry.messages_size(), 1); |
| 65 | *stream << *(entry.messages().begin()); |
| 66 | if (entry.count() == 1) { |
| 67 | *stream << "\n"; |
| 68 | } else { |
| 69 | *stream << " (1 of " << entry.count() << " similar)\n"; |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | string PrintErrorMapToString(const ErrorLogMap& errors) { |
| 76 | stringstream stream; |
no test coverage detected