Chromium Code Reviews| 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 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
| 6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
| 7 | 7 |
| 8 #include <cassert> | 8 #include <cassert> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <cstring> | 10 #include <cstring> |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) | 641 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) |
| 642 | 642 |
| 643 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) | 643 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) |
| 644 | 644 |
| 645 // Definitions for DCHECK et al. | 645 // Definitions for DCHECK et al. |
| 646 | 646 |
| 647 #if ENABLE_DCHECK | 647 #if ENABLE_DCHECK |
| 648 | 648 |
| 649 #if defined(NDEBUG) | 649 #if defined(NDEBUG) |
| 650 | 650 |
| 651 BASE_EXPORT extern DcheckState g_dcheck_state; | 651 DcheckState get_dcheck_state(); |
|
scottmg
2013/05/20 19:15:15
seems like a set_dcheck_state is needed too (ios)
| |
| 652 | 652 |
| 653 #if defined(DCHECK_ALWAYS_ON) | 653 #if defined(DCHECK_ALWAYS_ON) |
| 654 | 654 |
| 655 #define DCHECK_IS_ON() true | 655 #define DCHECK_IS_ON() true |
| 656 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 656 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
| 657 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 657 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
| 658 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL | 658 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL |
| 659 const LogSeverity LOG_DCHECK = LOG_FATAL; | 659 const LogSeverity LOG_DCHECK = LOG_FATAL; |
| 660 | 660 |
| 661 #else | 661 #else |
| 662 | 662 |
| 663 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 663 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
| 664 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) | 664 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) |
| 665 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT | 665 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT |
| 666 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; | 666 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; |
| 667 #define DCHECK_IS_ON() \ | 667 #define DCHECK_IS_ON() \ |
| 668 ((::logging::g_dcheck_state == \ | 668 ((::logging::get_dcheck_state() == \ |
| 669 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ | 669 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ |
| 670 LOG_IS_ON(DCHECK)) | 670 LOG_IS_ON(DCHECK)) |
| 671 | 671 |
| 672 #endif // defined(DCHECK_ALWAYS_ON) | 672 #endif // defined(DCHECK_ALWAYS_ON) |
| 673 | 673 |
| 674 #else // defined(NDEBUG) | 674 #else // defined(NDEBUG) |
| 675 | 675 |
| 676 // On a regular debug build, we want to have DCHECKs enabled. | 676 // On a regular debug build, we want to have DCHECKs enabled. |
| 677 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 677 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
| 678 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 678 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 #elif NOTIMPLEMENTED_POLICY == 5 | 982 #elif NOTIMPLEMENTED_POLICY == 5 |
| 983 #define NOTIMPLEMENTED() do {\ | 983 #define NOTIMPLEMENTED() do {\ |
| 984 static bool logged_once = false;\ | 984 static bool logged_once = false;\ |
| 985 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 985 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
| 986 logged_once = true;\ | 986 logged_once = true;\ |
| 987 } while(0);\ | 987 } while(0);\ |
| 988 EAT_STREAM_PARAMETERS | 988 EAT_STREAM_PARAMETERS |
| 989 #endif | 989 #endif |
| 990 | 990 |
| 991 #endif // BASE_LOGGING_H_ | 991 #endif // BASE_LOGGING_H_ |
| OLD | NEW |