| 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/browser/chromeos/system/syslogs_provider.h" | 5 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 zip_file_name->value(); | 139 zip_file_name->value(); |
| 140 if (::system(cmd.c_str()) == -1) | 140 if (::system(cmd.c_str()) == -1) |
| 141 LOG(WARNING) << "Command " << cmd << " failed to run"; | 141 LOG(WARNING) << "Command " << cmd << " failed to run"; |
| 142 } | 142 } |
| 143 // Read logs from the temp file | 143 // Read logs from the temp file |
| 144 std::string data; | 144 std::string data; |
| 145 bool read_success = file_util::ReadFileToString(temp_filename, | 145 bool read_success = file_util::ReadFileToString(temp_filename, |
| 146 &data); | 146 &data); |
| 147 // if we were using an internal temp file, the user does not need the | 147 // if we were using an internal temp file, the user does not need the |
| 148 // logs to stay past the ReadFile call - delete the file | 148 // logs to stay past the ReadFile call - delete the file |
| 149 base::Delete(temp_filename, false); | 149 base::DeleteFile(temp_filename, false); |
| 150 | 150 |
| 151 if (!read_success) | 151 if (!read_success) |
| 152 return NULL; | 152 return NULL; |
| 153 | 153 |
| 154 // Parse the return data into a dictionary | 154 // Parse the return data into a dictionary |
| 155 LogDictionaryType* logs = new LogDictionaryType(); | 155 LogDictionaryType* logs = new LogDictionaryType(); |
| 156 while (data.length() > 0) { | 156 while (data.length() > 0) { |
| 157 std::string key = ReadKey(&data); | 157 std::string key = ReadKey(&data); |
| 158 TrimWhitespaceASCII(key, TRIM_ALL, &key); | 158 TrimWhitespaceASCII(key, TRIM_ALL, &key); |
| 159 if (!key.empty()) { | 159 if (!key.empty()) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 LogDictionaryType* logs = NULL; | 314 LogDictionaryType* logs = NULL; |
| 315 logs = GetSystemLogs( | 315 logs = GetSystemLogs( |
| 316 compress_logs ? &zip_file : NULL, | 316 compress_logs ? &zip_file : NULL, |
| 317 GetSyslogsContextString(context)); | 317 GetSyslogsContextString(context)); |
| 318 | 318 |
| 319 std::string* zip_content = NULL; | 319 std::string* zip_content = NULL; |
| 320 if (compress_logs) { | 320 if (compress_logs) { |
| 321 // Load compressed logs. | 321 // Load compressed logs. |
| 322 zip_content = new std::string(); | 322 zip_content = new std::string(); |
| 323 LoadCompressedLogs(zip_file, zip_content); | 323 LoadCompressedLogs(zip_file, zip_content); |
| 324 base::Delete(zip_file, false); | 324 base::DeleteFile(zip_file, false); |
| 325 } | 325 } |
| 326 | 326 |
| 327 // Include dbus statistics summary | 327 // Include dbus statistics summary |
| 328 (*logs)["dbus"] = dbus::statistics::GetAsString( | 328 (*logs)["dbus"] = dbus::statistics::GetAsString( |
| 329 dbus::statistics::SHOW_INTERFACE, | 329 dbus::statistics::SHOW_INTERFACE, |
| 330 dbus::statistics::FORMAT_ALL); | 330 dbus::statistics::FORMAT_ALL); |
| 331 | 331 |
| 332 // Include recent network log events | 332 // Include recent network log events |
| 333 (*logs)["network_event_log"] = network_event_log::GetAsString( | 333 (*logs)["network_event_log"] = network_event_log::GetAsString( |
| 334 network_event_log::OLDEST_FIRST, | 334 network_event_log::OLDEST_FIRST, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 return Singleton<SyslogsProviderImpl, | 398 return Singleton<SyslogsProviderImpl, |
| 399 DefaultSingletonTraits<SyslogsProviderImpl> >::get(); | 399 DefaultSingletonTraits<SyslogsProviderImpl> >::get(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 SyslogsProvider* SyslogsProvider::GetInstance() { | 402 SyslogsProvider* SyslogsProvider::GetInstance() { |
| 403 return SyslogsProviderImpl::GetInstance(); | 403 return SyslogsProviderImpl::GetInstance(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace system | 406 } // namespace system |
| 407 } // namespace chromeos | 407 } // namespace chromeos |
| OLD | NEW |