Index: chrome/browser/sync/api/sync_error.cc |
diff --git a/chrome/browser/sync/api/sync_error.cc b/chrome/browser/sync/api/sync_error.cc |
index 6ffa495466bc9e13b6a8ce18790db7e354ed8ac6..92c97c0e418ffdaed514dbafe2ecca98313e512e 100644 |
--- a/chrome/browser/sync/api/sync_error.cc |
+++ b/chrome/browser/sync/api/sync_error.cc |
@@ -4,8 +4,12 @@ |
#include "chrome/browser/sync/api/sync_error.h" |
+#include <iostream> |
akalin
2011/09/22 01:24:56
iostream -> ostream (former introduces a static in
James Hawkins
2011/09/22 02:50:29
Done.
|
+#include <sstream> |
+ |
#include "base/logging.h" |
#include "base/tracked.h" |
+#include "chrome/browser/sync/syncable/model_type.h" |
SyncError::SyncError() { |
Clear(); |
@@ -83,6 +87,18 @@ syncable::ModelType SyncError::type() const { |
return type_; |
} |
+std::string SyncError::ToString() const { |
+ std::string out; |
+ std::stringstream ss(out, std::stringstream::in); |
akalin
2011/09/22 01:24:56
You don't really need a stringstream, do you? Jus
James Hawkins
2011/09/22 02:50:29
I don't print IsSet() anymore, so I changed it bac
|
+ ss << |
+ "{" << location_->ToString() << |
akalin
2011/09/22 01:24:56
type() and message() CHECK IsSet(). Suggest:
if
James Hawkins
2011/09/22 02:50:29
Done.
|
+ ", " << IsSet() << |
+ ", " << syncable::ModelTypeToString(type()) << |
+ ", " << message() << |
+ "}"; |
+ return out; |
+} |
+ |
void SyncError::PrintLogError() const { |
LAZY_STREAM(logging::LogMessage(location_->file_name(), |
location_->line_number(), |
@@ -90,3 +106,7 @@ void SyncError::PrintLogError() const { |
LOG_IS_ON(ERROR)) |
<< syncable::ModelTypeToString(type_) << " Sync Error: " << message_; |
} |
+ |
+void PrintTo(const SyncError& sync_error, std::ostream* os) { |
+ *os << sync_error.ToString(); |
+} |