Add static AsString functions for PeerConnectionInterface enums
Changes one preexisting enum-to-string function to use the new format.
Also changes the RTC_LOG macros that created collisions with ToString,
for tidiness, and documents the recommended function form.
Bug: webrtc:13272
Change-Id: Ic8bb54ed31402ba32675b142d796cf276ee78df5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235722
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35296}
diff --git a/api/rtc_error.h b/api/rtc_error.h
index 8ca2249..1376793 100644
--- a/api/rtc_error.h
+++ b/api/rtc_error.h
@@ -178,11 +178,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 << " (" << ToString(type) << ")"; \
- return webrtc::RTCError(type, message); \
+#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
+ { \
+ RTC_DCHECK(type != RTCErrorType::NONE); \
+ RTC_LOG(severity) << message << " (" << ::webrtc::ToString(type) << ")"; \
+ return ::webrtc::RTCError(type, message); \
}
#define LOG_AND_RETURN_ERROR(type, message) \