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 "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 #include "base/safe_strerror_posix.h" | 57 #include "base/safe_strerror_posix.h" |
58 #endif | 58 #endif |
59 | 59 |
60 #if defined(OS_ANDROID) | 60 #if defined(OS_ANDROID) |
61 #include <android/log.h> | 61 #include <android/log.h> |
62 #endif | 62 #endif |
63 | 63 |
64 namespace logging { | 64 namespace logging { |
65 | 65 |
66 DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 66 DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
| 67 DlogState g_dlog_state = DISABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
67 VlogInfo* g_vlog_info = NULL; | 68 VlogInfo* g_vlog_info = NULL; |
68 | 69 |
69 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { | 70 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { |
70 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; | 71 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; |
71 | 72 |
72 int min_log_level = 0; | 73 int min_log_level = 0; |
73 | 74 |
74 // 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 |
75 // 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; |
76 // 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 #endif | 348 #endif |
348 } | 349 } |
349 | 350 |
350 return true; | 351 return true; |
351 } | 352 } |
352 | 353 |
353 bool BaseInitLoggingImpl(const PathChar* new_log_file, | 354 bool BaseInitLoggingImpl(const PathChar* new_log_file, |
354 LoggingDestination logging_dest, | 355 LoggingDestination logging_dest, |
355 LogLockingState lock_log, | 356 LogLockingState lock_log, |
356 OldFileDeletionState delete_old, | 357 OldFileDeletionState delete_old, |
357 DcheckState dcheck_state) { | 358 DcheckState dcheck_state, |
| 359 DlogState dlog_state) { |
358 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 360 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
359 g_dcheck_state = dcheck_state; | 361 g_dcheck_state = dcheck_state; |
| 362 g_dlog_state = dlog_state; |
360 delete g_vlog_info; | 363 delete g_vlog_info; |
361 g_vlog_info = NULL; | 364 g_vlog_info = NULL; |
362 // Don't bother initializing g_vlog_info unless we use one of the | 365 // Don't bother initializing g_vlog_info unless we use one of the |
363 // vlog switches. | 366 // vlog switches. |
364 if (command_line->HasSwitch(switches::kV) || | 367 if (command_line->HasSwitch(switches::kV) || |
365 command_line->HasSwitch(switches::kVModule)) { | 368 command_line->HasSwitch(switches::kVModule)) { |
366 g_vlog_info = | 369 g_vlog_info = |
367 new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), | 370 new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), |
368 command_line->GetSwitchValueASCII(switches::kVModule), | 371 command_line->GetSwitchValueASCII(switches::kVModule), |
369 &min_log_level); | 372 &min_log_level); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 | 848 |
846 // This was defined at the beginnig of this file. | 849 // This was defined at the beginnig of this file. |
847 #undef write | 850 #undef write |
848 | 851 |
849 std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { | 852 std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { |
850 o.write(piece.data(), static_cast<std::streamsize>(piece.size())); | 853 o.write(piece.data(), static_cast<std::streamsize>(piece.size())); |
851 return o; | 854 return o; |
852 } | 855 } |
853 | 856 |
854 } // namespace base | 857 } // namespace base |
OLD | NEW |