| 79 | } |
| 80 | |
| 81 | void MergeErrorLogEntry(TErrorCode::type error_code, const ErrorLogEntryPB& entry, |
| 82 | ErrorLogMap* target_map) { |
| 83 | ErrorLogEntryPB* target = &(*target_map)[error_code]; |
| 84 | |
| 85 | // Append generic message, append specific codes or increment count if exists. |
| 86 | if (error_code == TErrorCode::GENERAL || target->messages_size() == 0) { |
| 87 | for (auto& msg : entry.messages()) { |
| 88 | target->add_messages(msg); |
| 89 | } |
| 90 | } |
| 91 | if (error_code != TErrorCode::GENERAL) { |
| 92 | target->set_count(target->count() + entry.count()); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void MergeErrorMaps(const ErrorLogMapPB& m1, ErrorLogMap* m2) { |
| 97 | for (const ErrorLogMapPB::value_type& v : m1) { |