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