Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8127)

Unified Diff: chrome/installer/util/installation_validation_helper.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up, MockLog uses listener Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/installation_validation_helper.cc
diff --git a/chrome/installer/util/installation_validation_helper.cc b/chrome/installer/util/installation_validation_helper.cc
index e0252e975b26380a34985e42d0343b4d41c1c0eb..cfeec095c23a1a402aae353101a6d078f720cec7 100644
--- a/chrome/installer/util/installation_validation_helper.cc
+++ b/chrome/installer/util/installation_validation_helper.cc
@@ -34,7 +34,6 @@ class FailureLogHelper {
const std::string& str);
static const logging::LogSeverity kViolationSeverity_;
- static logging::LogMessageHandlerFunction old_message_handler_;
static int old_min_log_level_;
};
@@ -44,29 +43,21 @@ const logging::LogSeverity
FailureLogHelper::kViolationSeverity_ = logging::LOG_ERROR;
// static
-logging::LogMessageHandlerFunction
- FailureLogHelper::old_message_handler_ = NULL;
-
-// static
int FailureLogHelper::old_min_log_level_ =
FailureLogHelper::kViolationSeverity_;
FailureLogHelper::FailureLogHelper() {
- LOG_ASSERT(old_message_handler_ == NULL);
-
// The validator logs at ERROR level. Ensure that it generates messages so we
// can transform them into test failures.
old_min_log_level_ = logging::GetMinLogLevel();
if (old_min_log_level_ > kViolationSeverity_)
logging::SetMinLogLevel(kViolationSeverity_);
- old_message_handler_ = logging::GetLogMessageHandler();
- logging::SetLogMessageHandler(&AddFailureForLogMessage);
+ logging::PushLogMessageHandler(AddFailureForLogMessage);
}
FailureLogHelper::~FailureLogHelper() {
- logging::SetLogMessageHandler(old_message_handler_);
- old_message_handler_ = NULL;
+ logging::PopLogMessageHandler(AddFailureForLogMessage);
Dan Beam 2016/07/15 03:11:19 awesome
if (old_min_log_level_ > kViolationSeverity_)
logging::SetMinLogLevel(old_min_log_level_);
@@ -92,9 +83,6 @@ bool FailureLogHelper::AddFailureForLogMessage(int severity,
return true;
}
- if (old_message_handler_ != NULL)
- return (old_message_handler_)(severity, file, line, message_start, str);
-
return false;
}

Powered by Google App Engine
This is Rietveld 408576698