| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 FILE* redir_stderr = _wfreopen(log_path.value().c_str(), L"w", stderr); | 137 FILE* redir_stderr = _wfreopen(log_path.value().c_str(), L"w", stderr); |
| 138 #else | 138 #else |
| 139 FILE* redir_stderr = freopen(log_path.value().c_str(), "w", stderr); | 139 FILE* redir_stderr = freopen(log_path.value().c_str(), "w", stderr); |
| 140 #endif | 140 #endif |
| 141 if (!redir_stderr) { | 141 if (!redir_stderr) { |
| 142 printf("Failed to redirect stderr to log file. Exiting...\n"); | 142 printf("Failed to redirect stderr to log file. Exiting...\n"); |
| 143 return 1; | 143 return 1; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool success = InitLogging( | 147 logging::LoggingSettings settings; |
| 148 NULL, | 148 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 149 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 149 bool success = logging::InitLogging(settings); |
| 150 logging::DONT_LOCK_LOG_FILE, | |
| 151 logging::DELETE_OLD_LOG_FILE, | |
| 152 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
| 153 if (!success) { | 150 if (!success) { |
| 154 PLOG(ERROR) << "Unable to initialize logging"; | 151 PLOG(ERROR) << "Unable to initialize logging"; |
| 155 } | 152 } |
| 156 logging::SetLogItems(false, // enable_process_id | 153 logging::SetLogItems(false, // enable_process_id |
| 157 false, // enable_thread_id | 154 false, // enable_thread_id |
| 158 false, // enable_timestamp | 155 false, // enable_timestamp |
| 159 false); // enable_tickcount | 156 false); // enable_tickcount |
| 160 Log::Level level = Log::kLog; | 157 Log::Level level = Log::kLog; |
| 161 if (cmd_line->HasSwitch("verbose")) | 158 if (cmd_line->HasSwitch("verbose")) |
| 162 level = Log::kDebug; | 159 level = Log::kDebug; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Close stderr on exec, so that Chrome log spew doesn't confuse users. | 192 // Close stderr on exec, so that Chrome log spew doesn't confuse users. |
| 196 fcntl(STDERR_FILENO, F_SETFD, FD_CLOEXEC); | 193 fcntl(STDERR_FILENO, F_SETFD, FD_CLOEXEC); |
| 197 } | 194 } |
| 198 #endif | 195 #endif |
| 199 | 196 |
| 200 // Run until we receive command to shutdown. | 197 // Run until we receive command to shutdown. |
| 201 shutdown_event.Wait(); | 198 shutdown_event.Wait(); |
| 202 | 199 |
| 203 return 0; | 200 return 0; |
| 204 } | 201 } |
| OLD | NEW |