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: Ia4e3e12b34716d76c05807e44db1ed4a62dffb87
Reviewed-on: https://webrtc-review.googlesource.com/97440
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24547}
This commit is contained in:
Jonas Olsson
2018-09-04 11:16:41 +02:00
committed by Commit Bot
parent 01cd853d2e
commit 4092cd6db4
5 changed files with 46 additions and 101 deletions

View File

@ -146,4 +146,10 @@ std::string ToHex(const int i) {
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