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

Unified Diff: chrome/test/chromedriver/logging.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « chrome/test/base/web_ui_browser_test.cc ('k') | components/crash/content/app/breakpad_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/logging.cc
diff --git a/chrome/test/chromedriver/logging.cc b/chrome/test/chromedriver/logging.cc
index afd73754ca19963be1f6f74e75d15fdb070a88a6..465e82e25d81f42648c29b5887baa062779fad57 100644
--- a/chrome/test/chromedriver/logging.cc
+++ b/chrome/test/chromedriver/logging.cc
@@ -97,11 +97,19 @@ bool InternalIsVLogOn(int vlog_level) {
return GetLevelFromSeverity(vlog_level * -1) >= level;
}
-bool HandleLogMessage(int severity,
- const char* file,
- int line,
- size_t message_start,
- const std::string& str) {
+class LogMessageListener : logging::LogMessageListener {
+ void OnMessage(int severity,
+ const char* file,
+ int line,
+ size_t message_start,
+ const std::string& str) override;
+};
+
+void LogMessageListener::OnMessage(int severity,
+ const char* file,
+ int line,
+ size_t message_start,
+ const std::string& str) {
Log::Level level = GetLevelFromSeverity(severity);
std::string message = str.substr(message_start);
@@ -121,8 +129,6 @@ bool HandleLogMessage(int severity,
WebDriverLog* session_log = GetSessionLog();
if (session_log)
session_log->AddEntry(level, message);
-
- return true;
}
} // namespace
@@ -238,7 +244,8 @@ bool InitLogging() {
false, // enable_thread_id
false, // enable_timestamp
false); // enable_tickcount
- logging::SetLogMessageHandler(&HandleLogMessage);
+
+ new LogMessageListener(); // Intentionally leak this instance.
logging::LoggingSettings logging_settings;
logging_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
« no previous file with comments | « chrome/test/base/web_ui_browser_test.cc ('k') | components/crash/content/app/breakpad_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698