| 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 #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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Temporarily allow it until we fix http://crbug.com/61143 | 238 // Temporarily allow it until we fix http://crbug.com/61143 |
| 239 base::ThreadRestrictions::ScopedAllowIO allow_io; | 239 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 240 // Always force a new symlink when redirecting. | 240 // Always force a new symlink when redirecting. |
| 241 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); | 241 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); |
| 242 | 242 |
| 243 logging::DcheckState dcheck_state = | 243 logging::DcheckState dcheck_state = |
| 244 command_line.HasSwitch(switches::kEnableDCHECK) ? | 244 command_line.HasSwitch(switches::kEnableDCHECK) ? |
| 245 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : | 245 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : |
| 246 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 246 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 247 | 247 |
| 248 logging::DlogState dlog_state = |
| 249 command_line.HasSwitch(switches::kEnableDLOG) ? |
| 250 logging::ENABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS: |
| 251 logging::DISABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 252 |
| 248 // ChromeOS always logs through the symlink, so it shouldn't be | 253 // ChromeOS always logs through the symlink, so it shouldn't be |
| 249 // deleted if it already exists. | 254 // deleted if it already exists. |
| 250 if (!InitLogging(log_path.value().c_str(), | 255 if (!InitLogging(log_path.value().c_str(), |
| 251 DetermineLogMode(command_line), | 256 DetermineLogMode(command_line), |
| 252 logging::LOCK_LOG_FILE, | 257 logging::LOCK_LOG_FILE, |
| 253 logging::APPEND_TO_OLD_LOG_FILE, | 258 logging::APPEND_TO_OLD_LOG_FILE, |
| 254 dcheck_state)) { | 259 dcheck_state, |
| 260 dlog_state)) { |
| 255 DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); | 261 DLOG(ERROR) << "Unable to initialize logging to " << log_path.value(); |
| 256 RemoveSymlinkAndLog(log_path, target_path); | 262 RemoveSymlinkAndLog(log_path, target_path); |
| 257 } else { | 263 } else { |
| 258 chrome_logging_redirected_ = true; | 264 chrome_logging_redirected_ = true; |
| 259 } | 265 } |
| 260 } | 266 } |
| 261 | 267 |
| 262 #endif // OS_CHROMEOS | 268 #endif // OS_CHROMEOS |
| 263 | 269 |
| 264 void InitChromeLogging(const CommandLine& command_line, | 270 void InitChromeLogging(const CommandLine& command_line, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // since that will remove the newly created link instead. | 305 // since that will remove the newly created link instead. |
| 300 delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE; | 306 delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE; |
| 301 #endif | 307 #endif |
| 302 } | 308 } |
| 303 | 309 |
| 304 logging::DcheckState dcheck_state = | 310 logging::DcheckState dcheck_state = |
| 305 command_line.HasSwitch(switches::kEnableDCHECK) ? | 311 command_line.HasSwitch(switches::kEnableDCHECK) ? |
| 306 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : | 312 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : |
| 307 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 313 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 308 | 314 |
| 315 logging::DlogState dlog_state = |
| 316 command_line.HasSwitch(switches::kEnableDLOG) ? |
| 317 logging::ENABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS: |
| 318 logging::DISABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 319 |
| 320 |
| 309 bool success = InitLogging(log_path.value().c_str(), | 321 bool success = InitLogging(log_path.value().c_str(), |
| 310 logging_dest, | 322 logging_dest, |
| 311 logging::LOCK_LOG_FILE, | 323 logging::LOCK_LOG_FILE, |
| 312 delete_old_log_file, | 324 delete_old_log_file, |
| 313 dcheck_state); | 325 dcheck_state, |
| 326 dlog_state); |
| 314 | 327 |
| 315 #if defined(OS_CHROMEOS) | 328 #if defined(OS_CHROMEOS) |
| 316 if (!success) { | 329 if (!success) { |
| 317 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value() | 330 DPLOG(ERROR) << "Unable to initialize logging to " << log_path.value() |
| 318 << " (which should be a link to " << target_path.value() << ")"; | 331 << " (which should be a link to " << target_path.value() << ")"; |
| 319 RemoveSymlinkAndLog(log_path, target_path); | 332 RemoveSymlinkAndLog(log_path, target_path); |
| 320 chrome_logging_failed_ = true; | 333 chrome_logging_failed_ = true; |
| 321 return; | 334 return; |
| 322 } | 335 } |
| 323 #else | 336 #else |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 void DumpWithoutCrashing() { | 466 void DumpWithoutCrashing() { |
| 454 #if defined(OS_WIN) | 467 #if defined(OS_WIN) |
| 455 std::string str; | 468 std::string str; |
| 456 DumpProcessAssertHandler(str); | 469 DumpProcessAssertHandler(str); |
| 457 #else | 470 #else |
| 458 NOTIMPLEMENTED(); | 471 NOTIMPLEMENTED(); |
| 459 #endif // OS_WIN | 472 #endif // OS_WIN |
| 460 } | 473 } |
| 461 | 474 |
| 462 } // namespace logging | 475 } // namespace logging |
| OLD | NEW |