| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #endif | 159 #endif |
| 160 | 160 |
| 161 base::AutoLock auto_lock(lock_); | 161 base::AutoLock auto_lock(lock_); |
| 162 fprintf(file_.get(), "%s", entry.c_str()); | 162 fprintf(file_.get(), "%s", entry.c_str()); |
| 163 fflush(file_.get()); | 163 fflush(file_.get()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool FileLog::GetLogContents(std::string* contents) const { | 166 bool FileLog::GetLogContents(std::string* contents) const { |
| 167 if (!file_.get()) | 167 if (!file_.get()) |
| 168 return false; | 168 return false; |
| 169 return file_util::ReadFileToString(path_, contents); | 169 return base::ReadFileToString(path_, contents); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool FileLog::IsOpen() const { | 172 bool FileLog::IsOpen() const { |
| 173 return !!file_.get(); | 173 return !!file_.get(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void FileLog::set_min_log_level(LogLevel level) { | 176 void FileLog::set_min_log_level(LogLevel level) { |
| 177 min_log_level_ = level; | 177 min_log_level_ = level; |
| 178 } | 178 } |
| 179 | 179 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), | 245 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), |
| 246 min_log_level); | 246 min_log_level); |
| 247 } else { | 247 } else { |
| 248 log = new FileLog(log_path, min_log_level); | 248 log = new FileLog(log_path, min_log_level); |
| 249 } | 249 } |
| 250 FileLog::SetGlobalLog(log); | 250 FileLog::SetGlobalLog(log); |
| 251 return log->IsOpen(); | 251 return log->IsOpen(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace webdriver | 254 } // namespace webdriver |
| OLD | NEW |