Reland "Consolidate loggability checks and replace streams."
Currently we check if a message should be printed at the call site using LogMessage::Loggable, in the LogMessage itself using LogMessage::IsNoop and in LogMessage::OutputToDebug using log_to_stderr_.
This change unifies the first two of these into a early return in Log().
Bug: webrtc:8982
Change-Id: I462b1cf63c44fec46e5c59b147b2b99605aaae0c
Reviewed-on: https://webrtc-review.googlesource.com/98820
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24630}
diff --git a/rtc_base/stringutils.cc b/rtc_base/stringutils.cc
index bef128c..6baddd1 100644
--- a/rtc_base/stringutils.cc
+++ b/rtc_base/stringutils.cc
@@ -146,4 +146,10 @@
return std::string(buffer);
}
+std::string LeftPad(char padding, unsigned length, std::string s) {
+ if (s.length() >= length)
+ return s;
+ return std::string(length - s.length(), padding) + s;
+}
+
} // namespace rtc