| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 typedef HANDLE FileHandle; | 10 typedef HANDLE FileHandle; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #if defined(OS_POSIX) | 57 #if defined(OS_POSIX) |
| 58 #include "base/safe_strerror_posix.h" | 58 #include "base/safe_strerror_posix.h" |
| 59 #endif | 59 #endif |
| 60 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
| 61 #include "base/mac/scoped_cftyperef.h" | 61 #include "base/mac/scoped_cftyperef.h" |
| 62 #include "base/sys_string_conversions.h" | 62 #include "base/sys_string_conversions.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 namespace logging { | 65 namespace logging { |
| 66 | 66 |
| 67 bool g_enable_dcheck = false; | 67 DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 68 VlogInfo* g_vlog_info = NULL; | 68 VlogInfo* g_vlog_info = NULL; |
| 69 | 69 |
| 70 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { | 70 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { |
| 71 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; | 71 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; |
| 72 | 72 |
| 73 int min_log_level = 0; | 73 int min_log_level = 0; |
| 74 | 74 |
| 75 // The default set here for logging_destination will only be used if | 75 // The default set here for logging_destination will only be used if |
| 76 // InitLogging is not called. On Windows, use a file next to the exe; | 76 // InitLogging is not called. On Windows, use a file next to the exe; |
| 77 // on POSIX platforms, where it may not even be possible to locate the | 77 // on POSIX platforms, where it may not even be possible to locate the |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 return false; | 346 return false; |
| 347 #endif | 347 #endif |
| 348 } | 348 } |
| 349 | 349 |
| 350 return true; | 350 return true; |
| 351 } | 351 } |
| 352 | 352 |
| 353 bool BaseInitLoggingImpl(const PathChar* new_log_file, | 353 bool BaseInitLoggingImpl(const PathChar* new_log_file, |
| 354 LoggingDestination logging_dest, | 354 LoggingDestination logging_dest, |
| 355 LogLockingState lock_log, | 355 LogLockingState lock_log, |
| 356 OldFileDeletionState delete_old) { | 356 OldFileDeletionState delete_old, |
| 357 DcheckState dcheck_state) { |
| 357 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 358 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 358 g_enable_dcheck = | 359 g_dcheck_state = dcheck_state; |
| 359 command_line->HasSwitch(switches::kEnableDCHECK); | |
| 360 delete g_vlog_info; | 360 delete g_vlog_info; |
| 361 g_vlog_info = NULL; | 361 g_vlog_info = NULL; |
| 362 // Don't bother initializing g_vlog_info unless we use one of the | 362 // Don't bother initializing g_vlog_info unless we use one of the |
| 363 // vlog switches. | 363 // vlog switches. |
| 364 if (command_line->HasSwitch(switches::kV) || | 364 if (command_line->HasSwitch(switches::kV) || |
| 365 command_line->HasSwitch(switches::kVModule)) { | 365 command_line->HasSwitch(switches::kVModule)) { |
| 366 g_vlog_info = | 366 g_vlog_info = |
| 367 new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), | 367 new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), |
| 368 command_line->GetSwitchValueASCII(switches::kVModule), | 368 command_line->GetSwitchValueASCII(switches::kVModule), |
| 369 &min_log_level); | 369 &min_log_level); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 817 |
| 818 if (level == LOG_FATAL) | 818 if (level == LOG_FATAL) |
| 819 base::debug::BreakDebugger(); | 819 base::debug::BreakDebugger(); |
| 820 } | 820 } |
| 821 | 821 |
| 822 } // namespace logging | 822 } // namespace logging |
| 823 | 823 |
| 824 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 824 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
| 825 return out << WideToUTF8(std::wstring(wstr)); | 825 return out << WideToUTF8(std::wstring(wstr)); |
| 826 } | 826 } |
| OLD | NEW |