| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // static | 54 // static |
| 55 const logging::LogSeverity | 55 const logging::LogSeverity |
| 56 ConsoleLogHelper::kViolationSeverity_ = logging::LOG_ERROR; | 56 ConsoleLogHelper::kViolationSeverity_ = logging::LOG_ERROR; |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 logging::LogMessageHandlerFunction | 59 logging::LogMessageHandlerFunction |
| 60 ConsoleLogHelper::old_message_handler_ = NULL; | 60 ConsoleLogHelper::old_message_handler_ = NULL; |
| 61 | 61 |
| 62 ConsoleLogHelper::ConsoleLogHelper() : log_file_path_(GetLogFilePath()) { | 62 ConsoleLogHelper::ConsoleLogHelper() : log_file_path_(GetLogFilePath()) { |
| 63 LOG_ASSERT(old_message_handler_ == NULL); | 63 LOG_ASSERT(old_message_handler_ == NULL); |
| 64 logging::InitLogging( | 64 logging::LoggingSettings settings; |
| 65 log_file_path_.value().c_str(), | 65 settings.logging_dest = logging::LOG_TO_FILE; |
| 66 logging::LOG_ONLY_TO_FILE, | 66 settings.log_file = log_file_path_.value().c_str(); |
| 67 logging::DONT_LOCK_LOG_FILE, | 67 settings.lock_log = logging::DONT_LOCK_LOG_FILE; |
| 68 logging::DELETE_OLD_LOG_FILE, | 68 settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
| 69 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 69 logging::InitLogging(settings); |
| 70 | 70 |
| 71 old_message_handler_ = logging::GetLogMessageHandler(); | 71 old_message_handler_ = logging::GetLogMessageHandler(); |
| 72 logging::SetLogMessageHandler(&DumpLogMessage); | 72 logging::SetLogMessageHandler(&DumpLogMessage); |
| 73 } | 73 } |
| 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(); |
| (...skipping 100 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 |