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

Side by Side 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: address comments, format 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/chromedriver/logging.h" 5 #include "chrome/test/chromedriver/logging.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 g_log_level = Log::kAll; 230 g_log_level = Log::kAll;
231 231
232 // Turn on VLOG for chromedriver. This is parsed during logging::InitLogging. 232 // Turn on VLOG for chromedriver. This is parsed during logging::InitLogging.
233 cmd_line->AppendSwitchASCII("vmodule", "*/chrome/test/chromedriver/*=3"); 233 cmd_line->AppendSwitchASCII("vmodule", "*/chrome/test/chromedriver/*=3");
234 234
235 logging::SetMinLogLevel(logging::LOG_WARNING); 235 logging::SetMinLogLevel(logging::LOG_WARNING);
236 logging::SetLogItems(false, // enable_process_id 236 logging::SetLogItems(false, // enable_process_id
237 false, // enable_thread_id 237 false, // enable_thread_id
238 false, // enable_timestamp 238 false, // enable_timestamp
239 false); // enable_tickcount 239 false); // enable_tickcount
240 logging::SetLogMessageHandler(&HandleLogMessage); 240 logging::PushLogMessageHandler(&HandleLogMessage);
241 241
242 logging::LoggingSettings logging_settings; 242 logging::LoggingSettings logging_settings;
243 logging_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 243 logging_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
244 return logging::InitLogging(logging_settings); 244 return logging::InitLogging(logging_settings);
245 } 245 }
246 246
247 Status CreateLogs(const Capabilities& capabilities, 247 Status CreateLogs(const Capabilities& capabilities,
248 const Session* session, 248 const Session* session,
249 ScopedVector<WebDriverLog>* out_logs, 249 ScopedVector<WebDriverLog>* out_logs,
250 ScopedVector<DevToolsEventListener>* out_devtools_listeners, 250 ScopedVector<DevToolsEventListener>* out_devtools_listeners,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 logs.push_back(browser_log); 291 logs.push_back(browser_log);
292 // If the level is OFF, don't even bother listening for DevTools events. 292 // If the level is OFF, don't even bother listening for DevTools events.
293 if (browser_log_level != Log::kOff) 293 if (browser_log_level != Log::kOff)
294 devtools_listeners.push_back(new ConsoleLogger(browser_log)); 294 devtools_listeners.push_back(new ConsoleLogger(browser_log));
295 295
296 out_logs->swap(logs); 296 out_logs->swap(logs);
297 out_devtools_listeners->swap(devtools_listeners); 297 out_devtools_listeners->swap(devtools_listeners);
298 out_command_listeners->swap(command_listeners); 298 out_command_listeners->swap(command_listeners);
299 return Status(kOk); 299 return Status(kOk);
300 } 300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698