OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 // Need to include this before most other files because it defines | 7 // Need to include this before most other files because it defines |
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the | 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the |
10 // ViewMsgLog et al. functions. | 10 // ViewMsgLog et al. functions. |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include <windows.h> | 26 #include <windows.h> |
27 #endif | 27 #endif |
28 | 28 |
29 #include <fstream> | 29 #include <fstream> |
30 | 30 |
31 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
32 | 32 |
33 #include "base/command_line.h" | 33 #include "base/command_line.h" |
34 #include "base/compiler_specific.h" | 34 #include "base/compiler_specific.h" |
35 #include "base/debug_util.h" | 35 #include "base/debug_util.h" |
36 #include "base/env_var.h" | 36 #include "base/environment.h" |
37 #include "base/file_path.h" | 37 #include "base/file_path.h" |
38 #include "base/file_util.h" | 38 #include "base/file_util.h" |
39 #include "base/logging.h" | 39 #include "base/logging.h" |
40 #include "base/path_service.h" | 40 #include "base/path_service.h" |
41 #include "base/string_number_conversions.h" | 41 #include "base/string_number_conversions.h" |
42 #include "base/string_util.h" | 42 #include "base/string_util.h" |
43 #include "base/time.h" | 43 #include "base/time.h" |
44 #include "base/utf_string_conversions.h" | 44 #include "base/utf_string_conversions.h" |
45 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
46 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 logging::LOCK_LOG_FILE, | 190 logging::LOCK_LOG_FILE, |
191 delete_old_log_file); | 191 delete_old_log_file); |
192 | 192 |
193 // we want process and thread IDs because we have a lot of things running | 193 // we want process and thread IDs because we have a lot of things running |
194 logging::SetLogItems(true, true, false, true); | 194 logging::SetLogItems(true, true, false, true); |
195 | 195 |
196 // We call running in unattended mode "headless", and allow | 196 // We call running in unattended mode "headless", and allow |
197 // headless mode to be configured either by the Environment | 197 // headless mode to be configured either by the Environment |
198 // Variable or by the Command Line Switch. This is for | 198 // Variable or by the Command Line Switch. This is for |
199 // automated test purposes. | 199 // automated test purposes. |
200 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); | 200 scoped_ptr<base::Environment> env(base::Environment::Create()); |
201 if (env->HasEnv(env_vars::kHeadless) || | 201 if (env->HasEnv(env_vars::kHeadless) || |
202 command_line.HasSwitch(switches::kNoErrorDialogs)) | 202 command_line.HasSwitch(switches::kNoErrorDialogs)) |
203 SuppressDialogs(); | 203 SuppressDialogs(); |
204 | 204 |
205 std::string log_filter_prefix = | 205 std::string log_filter_prefix = |
206 command_line.GetSwitchValueASCII(switches::kLogFilterPrefix); | 206 command_line.GetSwitchValueASCII(switches::kLogFilterPrefix); |
207 logging::SetLogFilterPrefix(log_filter_prefix.c_str()); | 207 logging::SetLogFilterPrefix(log_filter_prefix.c_str()); |
208 | 208 |
209 // Use a minimum log level if the command line has one, otherwise set the | 209 // Use a minimum log level if the command line has one, otherwise set the |
210 // default to LOG_WARNING. | 210 // default to LOG_WARNING. |
(...skipping 22 matching lines...) Expand all Loading... |
233 DCHECK(chrome_logging_initialized_) << | 233 DCHECK(chrome_logging_initialized_) << |
234 "Attempted to clean up logging when it wasn't initialized."; | 234 "Attempted to clean up logging when it wasn't initialized."; |
235 | 235 |
236 CloseLogFile(); | 236 CloseLogFile(); |
237 | 237 |
238 chrome_logging_initialized_ = false; | 238 chrome_logging_initialized_ = false; |
239 } | 239 } |
240 | 240 |
241 FilePath GetLogFileName() { | 241 FilePath GetLogFileName() { |
242 std::string filename; | 242 std::string filename; |
243 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); | 243 scoped_ptr<base::Environment> env(base::Environment::Create()); |
244 if (env->GetEnv(env_vars::kLogFileName, &filename) && !filename.empty()) { | 244 if (env->GetEnv(env_vars::kLogFileName, &filename) && !filename.empty()) { |
245 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
246 return FilePath(UTF8ToWide(filename).c_str()); | 246 return FilePath(UTF8ToWide(filename).c_str()); |
247 #elif defined(OS_POSIX) | 247 #elif defined(OS_POSIX) |
248 return FilePath(filename.c_str()); | 248 return FilePath(filename.c_str()); |
249 #endif | 249 #endif |
250 } | 250 } |
251 | 251 |
252 const FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log")); | 252 const FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log")); |
253 FilePath log_path; | 253 FilePath log_path; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 assertions->push_back(wide_line); | 287 assertions->push_back(wide_line); |
288 ++assertion_count; | 288 ++assertion_count; |
289 } | 289 } |
290 } | 290 } |
291 log_file.close(); | 291 log_file.close(); |
292 | 292 |
293 return assertion_count; | 293 return assertion_count; |
294 } | 294 } |
295 | 295 |
296 } // namespace logging | 296 } // namespace logging |
OLD | NEW |