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 BASE_EXPORT DcheckState get_dcheck_state(); |
| 652 BASE_EXPORT void set_dcheck_state(DcheckState state); |
652 | 653 |
653 #if defined(DCHECK_ALWAYS_ON) | 654 #if defined(DCHECK_ALWAYS_ON) |
654 | 655 |
655 #define DCHECK_IS_ON() true | 656 #define DCHECK_IS_ON() true |
656 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 657 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
657 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 658 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
658 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL | 659 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL |
659 const LogSeverity LOG_DCHECK = LOG_FATAL; | 660 const LogSeverity LOG_DCHECK = LOG_FATAL; |
660 | 661 |
661 #else | 662 #else |
662 | 663 |
663 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 664 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
664 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) | 665 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) |
665 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT | 666 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT |
666 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; | 667 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; |
667 #define DCHECK_IS_ON() \ | 668 #define DCHECK_IS_ON() \ |
668 ((::logging::g_dcheck_state == \ | 669 ((::logging::get_dcheck_state() == \ |
669 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ | 670 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ |
670 LOG_IS_ON(DCHECK)) | 671 LOG_IS_ON(DCHECK)) |
671 | 672 |
672 #endif // defined(DCHECK_ALWAYS_ON) | 673 #endif // defined(DCHECK_ALWAYS_ON) |
673 | 674 |
674 #else // defined(NDEBUG) | 675 #else // defined(NDEBUG) |
675 | 676 |
676 // On a regular debug build, we want to have DCHECKs enabled. | 677 // On a regular debug build, we want to have DCHECKs enabled. |
677 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 678 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
678 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 679 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 | 983 #elif NOTIMPLEMENTED_POLICY == 5 |
983 #define NOTIMPLEMENTED() do {\ | 984 #define NOTIMPLEMENTED() do {\ |
984 static bool logged_once = false;\ | 985 static bool logged_once = false;\ |
985 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 986 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
986 logged_once = true;\ | 987 logged_once = true;\ |
987 } while(0);\ | 988 } while(0);\ |
988 EAT_STREAM_PARAMETERS | 989 EAT_STREAM_PARAMETERS |
989 #endif | 990 #endif |
990 | 991 |
991 #endif // BASE_LOGGING_H_ | 992 #endif // BASE_LOGGING_H_ |
OLD | NEW |