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 "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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "base/strings/utf_string_conversions.h" | 45 #include "base/strings/utf_string_conversions.h" |
46 #include "base/threading/thread_restrictions.h" | 46 #include "base/threading/thread_restrictions.h" |
47 #include "base/time/time.h" | 47 #include "base/time/time.h" |
48 #include "chrome/common/chrome_constants.h" | 48 #include "chrome/common/chrome_constants.h" |
49 #include "chrome/common/chrome_paths.h" | 49 #include "chrome/common/chrome_paths.h" |
50 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
51 #include "chrome/common/env_vars.h" | 51 #include "chrome/common/env_vars.h" |
52 #include "ipc/ipc_logging.h" | 52 #include "ipc/ipc_logging.h" |
53 | 53 |
54 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
55 #include "base/sys_info.h" | |
55 #include "chromeos/chromeos_switches.h" | 56 #include "chromeos/chromeos_switches.h" |
56 #endif | 57 #endif |
57 | 58 |
58 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
59 #include <initguid.h> | 60 #include <initguid.h> |
60 #include "base/logging_win.h" | 61 #include "base/logging_win.h" |
61 #endif | 62 #endif |
62 | 63 |
63 namespace { | 64 namespace { |
64 | 65 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 base::ThreadRestrictions::ScopedAllowIO allow_io; | 233 base::ThreadRestrictions::ScopedAllowIO allow_io; |
233 // Always force a new symlink when redirecting. | 234 // Always force a new symlink when redirecting. |
234 base::FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); | 235 base::FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); |
235 | 236 |
236 // ChromeOS always logs through the symlink, so it shouldn't be | 237 // ChromeOS always logs through the symlink, so it shouldn't be |
237 // deleted if it already exists. | 238 // deleted if it already exists. |
238 logging::LoggingSettings settings; | 239 logging::LoggingSettings settings; |
239 settings.logging_dest = DetermineLogMode(command_line); | 240 settings.logging_dest = DetermineLogMode(command_line); |
240 settings.log_file = log_path.value().c_str(); | 241 settings.log_file = log_path.value().c_str(); |
241 if (!logging::InitLogging(settings)) { | 242 if (!logging::InitLogging(settings)) { |
242 DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); | 243 if (base::SysInfo::IsRunningOnChromeOS()) { |
243 RemoveSymlinkAndLog(log_path, target_path); | 244 DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); |
sky
2014/07/11 23:33:24
Do we always want to remove the symlink?
stevenjb
2014/07/14 17:20:32
Maybe? I think I am going to leave this as it was,
| |
245 RemoveSymlinkAndLog(log_path, target_path); | |
246 } | |
244 } else { | 247 } else { |
245 chrome_logging_redirected_ = true; | 248 chrome_logging_redirected_ = true; |
246 } | 249 } |
247 } | 250 } |
248 | 251 |
249 #endif // OS_CHROMEOS | 252 #endif // OS_CHROMEOS |
250 | 253 |
251 void InitChromeLogging(const CommandLine& command_line, | 254 void InitChromeLogging(const CommandLine& command_line, |
252 OldFileDeletionState delete_old_log_file) { | 255 OldFileDeletionState delete_old_log_file) { |
253 DCHECK(!chrome_logging_initialized_) << | 256 DCHECK(!chrome_logging_initialized_) << |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 time_deets.year, | 427 time_deets.year, |
425 time_deets.month, | 428 time_deets.month, |
426 time_deets.day_of_month, | 429 time_deets.day_of_month, |
427 time_deets.hour, | 430 time_deets.hour, |
428 time_deets.minute, | 431 time_deets.minute, |
429 time_deets.second); | 432 time_deets.second); |
430 return base_path.InsertBeforeExtensionASCII(suffix); | 433 return base_path.InsertBeforeExtensionASCII(suffix); |
431 } | 434 } |
432 | 435 |
433 } // namespace logging | 436 } // namespace logging |
OLD | NEW |