OLD | NEW |
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/webdriver/webdriver_logging.h" | 5 #include "chrome/test/webdriver/webdriver_logging.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 void Logger::set_min_log_level(LogLevel level) { | 223 void Logger::set_min_log_level(LogLevel level) { |
224 min_log_level_ = level; | 224 min_log_level_ = level; |
225 } | 225 } |
226 | 226 |
227 bool InitWebDriverLogging(const base::FilePath& log_path, | 227 bool InitWebDriverLogging(const base::FilePath& log_path, |
228 LogLevel min_log_level) { | 228 LogLevel min_log_level) { |
229 start_time = base::Time::Now().ToDoubleT(); | 229 start_time = base::Time::Now().ToDoubleT(); |
230 // Turn off base/logging. | 230 // Turn off base/logging. |
231 bool success = InitLogging( | 231 logging::LoggingSettings settings; |
232 NULL, | 232 settings.logging_dest = logging::LOG_NONE; |
233 logging::LOG_NONE, | 233 bool success = logging::InitLogging(settings); |
234 logging::DONT_LOCK_LOG_FILE, | |
235 logging::DELETE_OLD_LOG_FILE, | |
236 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
237 if (!success) { | 234 if (!success) { |
238 PLOG(ERROR) << "Unable to initialize logging"; | 235 PLOG(ERROR) << "Unable to initialize logging"; |
239 } | 236 } |
240 logging::SetLogItems(false, // enable_process_id | 237 logging::SetLogItems(false, // enable_process_id |
241 false, // enable_thread_id | 238 false, // enable_thread_id |
242 true, // enable_timestamp | 239 true, // enable_timestamp |
243 false); // enable_tickcount | 240 false); // enable_tickcount |
244 | 241 |
245 // Init global file log. | 242 // Init global file log. |
246 FileLog* log; | 243 FileLog* log; |
247 if (log_path.empty()) { | 244 if (log_path.empty()) { |
248 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), | 245 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), |
249 min_log_level); | 246 min_log_level); |
250 } else { | 247 } else { |
251 log = new FileLog(log_path, min_log_level); | 248 log = new FileLog(log_path, min_log_level); |
252 } | 249 } |
253 FileLog::SetGlobalLog(log); | 250 FileLog::SetGlobalLog(log); |
254 return log->IsOpen(); | 251 return log->IsOpen(); |
255 } | 252 } |
256 | 253 |
257 } // namespace webdriver | 254 } // namespace webdriver |
OLD | NEW |