From 531bd0fbb9b6b4033474413b3d60eb2d3f7bd3d4 Mon Sep 17 00:00:00 2001 From: Markus Handell Date: Wed, 8 Jul 2020 10:58:19 +0200 Subject: [PATCH] Clarify logging docs. This change clarifies docs related to https://webrtc-review.googlesource.com/c/src/+/176902. Bug: webrtc:11567 Change-Id: I0a96c3b6cc04b0a5f7f45101ae755a94aa4d07ef Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178866 Commit-Queue: Tommi Reviewed-by: Tommi Cr-Commit-Position: refs/heads/master@{#31680} --- rtc_base/logging.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rtc_base/logging.h b/rtc_base/logging.h index 1e5f7258a3..0852c06182 100644 --- a/rtc_base/logging.h +++ b/rtc_base/logging.h @@ -464,9 +464,14 @@ class LogMessage { static void SetLogToStderr(bool log_to_stderr); // Stream: Any non-blocking stream interface. // Installs the |stream| to collect logs with severtiy |min_sev| or higher. - // |stream| must live until deinstalled by RemoveLogToStream + // |stream| must live until deinstalled by RemoveLogToStream. + // If |stream| is the first stream added to the system, we might miss some + // early concurrent log statement happening from another thread happening near + // this instant. static void AddLogToStream(LogSink* stream, LoggingSeverity min_sev); - // Removes the specified stream, without destroying it. + // Removes the specified stream, without destroying it. When the method + // has completed, it's guaranteed that |stream| will receive no more logging + // calls. static void RemoveLogToStream(LogSink* stream); // Returns the severity for the specified stream, of if none is specified, // the minimum stream severity. @@ -560,7 +565,7 @@ class LogMessage { // Holds true with high probability if |streams_| is empty, false with high // probability otherwise. Operated on with std::memory_order_relaxed because - // it's ok to loose or log some additional statements near the instant streams + // it's ok to lose or log some additional statements near the instant streams // are added/removed. static std::atomic streams_empty_;