| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // Path to the WebDriver log file. | 13 // Path to the WebDriver log file. |
| 14 const FilePath::CharType kLogPath[] = FILE_PATH_LITERAL("chromedriver.log"); | 14 const FilePath::CharType kLogPath[] = FILE_PATH_LITERAL("chromedriver.log"); |
| 15 | 15 |
| 16 } // namespace | 16 } // namespace |
| 17 | 17 |
| 18 namespace webdriver { | 18 namespace webdriver { |
| 19 | 19 |
| 20 void InitWebDriverLogging(int min_log_level) { | 20 void InitWebDriverLogging(int min_log_level) { |
| 21 bool success = InitLogging( | 21 bool success = InitLogging( |
| 22 kLogPath, | 22 kLogPath, |
| 23 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 23 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, |
| 24 logging::LOCK_LOG_FILE, | 24 logging::LOCK_LOG_FILE, |
| 25 logging::DELETE_OLD_LOG_FILE, | 25 logging::DELETE_OLD_LOG_FILE, |
| 26 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 26 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS, |
| 27 logging::DISABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
| 27 if (!success) { | 28 if (!success) { |
| 28 PLOG(ERROR) << "Unable to initialize logging"; | 29 PLOG(ERROR) << "Unable to initialize logging"; |
| 29 } | 30 } |
| 30 logging::SetLogItems(false, // enable_process_id | 31 logging::SetLogItems(false, // enable_process_id |
| 31 false, // enable_thread_id | 32 false, // enable_thread_id |
| 32 true, // enable_timestamp | 33 true, // enable_timestamp |
| 33 false); // enable_tickcount | 34 false); // enable_tickcount |
| 34 logging::SetMinLogLevel(min_log_level); | 35 logging::SetMinLogLevel(min_log_level); |
| 35 } | 36 } |
| 36 | 37 |
| 37 bool GetLogContents(std::string* log_contents) { | 38 bool GetLogContents(std::string* log_contents) { |
| 38 return file_util::ReadFileToString(FilePath(kLogPath), log_contents); | 39 return file_util::ReadFileToString(FilePath(kLogPath), log_contents); |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace webdriver | 42 } // namespace webdriver |
| OLD | NEW |