RTC_LOG: Fix bug introduced in a recent CL
https://webrtc-review.googlesource.com/c/src/+/184922 removed the
check for whether we should actually emit a given log message or not
from the main logging function, and attempted to put it around each
call site instead, so that we could check first and avoid computing
log arguments if the check says no.
However, it missed these two places.
Bug: webrtc:11968
Change-Id: I1a0d68888d1a2c9814bc02fe9db49d7084bad8fd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185004
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32162}
diff --git a/rtc_base/logging.h b/rtc_base/logging.h
index 4a0e090..d2607c2 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -638,11 +638,12 @@
return (LogMessage::GetMinLogSeverity() <= sev);
}
-#define RTC_LOG_E(sev, ctx, err) \
- RTC_LOG_ENABLED() && ::rtc::webrtc_logging_impl::LogCall() & \
- ::rtc::webrtc_logging_impl::LogStreamer<>() \
- << ::rtc::webrtc_logging_impl::LogMetadataErr { \
- {__FILE__, __LINE__, ::rtc::sev}, ::rtc::ERRCTX_##ctx, (err) \
+#define RTC_LOG_E(sev, ctx, err) \
+ !rtc::LogMessage::IsNoop<::rtc::sev>() && \
+ ::rtc::webrtc_logging_impl::LogCall() & \
+ ::rtc::webrtc_logging_impl::LogStreamer<>() \
+ << ::rtc::webrtc_logging_impl::LogMetadataErr { \
+ {__FILE__, __LINE__, ::rtc::sev}, ::rtc::ERRCTX_##ctx, (err) \
}
#define RTC_LOG_T(sev) RTC_LOG(sev) << this << ": "
@@ -675,11 +676,12 @@
}
} // namespace webrtc_logging_impl
-#define RTC_LOG_TAG(sev, tag) \
- RTC_LOG_ENABLED() && ::rtc::webrtc_logging_impl::LogCall() & \
- ::rtc::webrtc_logging_impl::LogStreamer<>() \
- << ::rtc::webrtc_logging_impl::LogMetadataTag { \
- sev, ::rtc::webrtc_logging_impl::AdaptString(tag) \
+#define RTC_LOG_TAG(sev, tag) \
+ !rtc::LogMessage::IsNoop(sev) && \
+ ::rtc::webrtc_logging_impl::LogCall() & \
+ ::rtc::webrtc_logging_impl::LogStreamer<>() \
+ << ::rtc::webrtc_logging_impl::LogMetadataTag { \
+ sev, ::rtc::webrtc_logging_impl::AdaptString(tag) \
}
#else