| 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 // A command-line tool that inspects the current system, displaying information | 5 // A command-line tool that inspects the current system, displaying information |
| 6 // about installed products. Violations are dumped to stderr. The process | 6 // about installed products. Violations are dumped to stderr. The process |
| 7 // exit code is 0 if there are no violations, or 1 otherwise. | 7 // exit code is 0 if there are no violations, or 1 otherwise. |
| 8 | 8 |
| 9 #include <cstdio> | 9 #include <cstdio> |
| 10 #include <cstdlib> | 10 #include <cstdlib> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 ConsoleLogHelper::~ConsoleLogHelper() { | 75 ConsoleLogHelper::~ConsoleLogHelper() { |
| 76 logging::SetLogMessageHandler(old_message_handler_); | 76 logging::SetLogMessageHandler(old_message_handler_); |
| 77 old_message_handler_ = NULL; | 77 old_message_handler_ = NULL; |
| 78 | 78 |
| 79 logging::CloseLogFile(); | 79 logging::CloseLogFile(); |
| 80 | 80 |
| 81 // Delete the log file if it wasn't written to (this is expected). | 81 // Delete the log file if it wasn't written to (this is expected). |
| 82 int64 file_size = 0; | 82 int64 file_size = 0; |
| 83 if (file_util::GetFileSize(log_file_path_, &file_size) && file_size == 0) | 83 if (file_util::GetFileSize(log_file_path_, &file_size) && file_size == 0) |
| 84 file_util::Delete(log_file_path_, false); | 84 base::Delete(log_file_path_, false); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Returns the path to the log file to create. The file should be empty at | 87 // Returns the path to the log file to create. The file should be empty at |
| 88 // process exit since we redirect log messages to stderr. | 88 // process exit since we redirect log messages to stderr. |
| 89 // static | 89 // static |
| 90 base::FilePath ConsoleLogHelper::GetLogFilePath() { | 90 base::FilePath ConsoleLogHelper::GetLogFilePath() { |
| 91 base::FilePath log_path; | 91 base::FilePath log_path; |
| 92 | 92 |
| 93 if (PathService::Get(base::DIR_TEMP, &log_path)) | 93 if (PathService::Get(base::DIR_TEMP, &log_path)) |
| 94 return log_path.Append(kLogFileName_); | 94 return log_path.Append(kLogFileName_); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 fprintf(stream, "%s installations%s: %s\n", LevelToString(system_level), | 180 fprintf(stream, "%s installations%s: %s\n", LevelToString(system_level), |
| 181 (is_valid ? "" : " (with errors)"), | 181 (is_valid ? "" : " (with errors)"), |
| 182 InstallationTypeToString(type).c_str()); | 182 InstallationTypeToString(type).c_str()); |
| 183 } | 183 } |
| 184 if (!is_valid) | 184 if (!is_valid) |
| 185 result = EXIT_FAILURE; | 185 result = EXIT_FAILURE; |
| 186 } | 186 } |
| 187 | 187 |
| 188 return result; | 188 return result; |
| 189 } | 189 } |
| OLD | NEW |