This CL removes all usages of our custom ostream << overloads.

This prepares us for removing them altogether.

Bug: webrtc:8982
Change-Id: I66002cc8d4bf0e07925766d568d2498422f0f38e
Reviewed-on: https://webrtc-review.googlesource.com/64142
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22707}
diff --git a/api/candidate.cc b/api/candidate.cc
index 62cd1bd..d51fb84 100644
--- a/api/candidate.cc
+++ b/api/candidate.cc
@@ -73,8 +73,9 @@
       sensitive ? address_.ToSensitiveString() : address_.ToString();
   ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_
       << ":" << protocol_ << ":" << priority_ << ":" << address << ":" << type_
-      << ":" << related_address_ << ":" << username_ << ":" << password_ << ":"
-      << network_id_ << ":" << network_cost_ << ":" << generation_ << "]";
+      << ":" << related_address_.ToString() << ":" << username_ << ":"
+      << password_ << ":" << network_id_ << ":" << network_cost_ << ":"
+      << generation_ << "]";
   return ost.str();
 }
 
diff --git a/api/rtcerror.h b/api/rtcerror.h
index 760bad8..d7dec29 100644
--- a/api/rtcerror.h
+++ b/api/rtcerror.h
@@ -150,11 +150,11 @@
 // Helper macro that can be used by implementations to create an error with a
 // message and log it. |message| should be a string literal or movable
 // std::string.
-#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
-  {                                                      \
-    RTC_DCHECK(type != RTCErrorType::NONE);              \
-    RTC_LOG(severity) << message << " (" << type << ")"; \
-    return webrtc::RTCError(type, message);              \
+#define LOG_AND_RETURN_ERROR_EX(type, message, severity)           \
+  {                                                                \
+    RTC_DCHECK(type != RTCErrorType::NONE);                        \
+    RTC_LOG(severity) << message << " (" << ToString(type) << ")"; \
+    return webrtc::RTCError(type, message);                        \
   }
 
 #define LOG_AND_RETURN_ERROR(type, message) \
diff --git a/api/rtcerror_unittest.cc b/api/rtcerror_unittest.cc
index d8f7ca6..90593cf 100644
--- a/api/rtcerror_unittest.cc
+++ b/api/rtcerror_unittest.cc
@@ -58,15 +58,6 @@
 
 namespace webrtc {
 
-// Simple test for ostream operator for RTCErrorType.
-TEST(RTCErrorTypeTest, OstreamOperator) {
-  std::ostringstream oss;
-  oss << webrtc::RTCErrorType::NONE << ' '
-      << webrtc::RTCErrorType::INVALID_PARAMETER << ' '
-      << webrtc::RTCErrorType::INTERNAL_ERROR;
-  EXPECT_EQ("NONE INVALID_PARAMETER INTERNAL_ERROR", oss.str());
-}
-
 // Test that the default constructor creates a "no error" error.
 TEST(RTCErrorTest, DefaultConstructor) {
   RTCError e;