summaryrefslogtreecommitdiffstats
path: root/base/logging.cpp
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2016-09-23 13:31:52 -0700
committerAndreas Gampe <agampe@google.com>2016-09-23 13:31:52 -0700
commit19ff8f1e57154686eeb51375fbcee5bf0f6457e3 (patch)
treee77af3421812e95e6e0753f9a1fb97a9938fc49c /base/logging.cpp
parent58af713d8a2b15eb211466aa51fa7acfb6356671 (diff)
downloadsystem_core-19ff8f1e57154686eeb51375fbcee5bf0f6457e3.tar.gz
system_core-19ff8f1e57154686eeb51375fbcee5bf0f6457e3.tar.bz2
system_core-19ff8f1e57154686eeb51375fbcee5bf0f6457e3.zip
Base: Check severity in destructor
Bug: 31338270 Test: m Test: mmma system/core/base && $ANDROID_HOST_OUT/nativetest64/libbase_test/libbase_test64 Change-Id: Ic077822bcfd591bd11f4fa9d4b6e440b461c70c1
Diffstat (limited to 'base/logging.cpp')
-rw-r--r--base/logging.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/logging.cpp b/base/logging.cpp
index 77a0a43c3..2ca224650 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -390,6 +390,11 @@ LogMessage::LogMessage(const char* file, unsigned int line, LogId id,
}
LogMessage::~LogMessage() {
+ // Check severity again. This is duplicate work wrt/ LOG macros, but not LOG_STREAM.
+ if (!WOULD_LOG_SEVERITY(data_->GetSeverity())) {
+ return;
+ }
+
// Finish constructing the message.
if (data_->GetError() != -1) {
data_->GetBuffer() << ": " << strerror(data_->GetError());