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 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <cassert> | 9 #include <cassert> |
10 #include <string> | 10 #include <string> |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 #define DVLOG(verboselevel) DLOG_IF(INFO, VLOG_IS_ON(verboselevel)) | 612 #define DVLOG(verboselevel) DLOG_IF(INFO, VLOG_IS_ON(verboselevel)) |
613 | 613 |
614 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) | 614 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) |
615 | 615 |
616 // Definitions for DCHECK et al. | 616 // Definitions for DCHECK et al. |
617 | 617 |
618 #if ENABLE_DCHECK | 618 #if ENABLE_DCHECK |
619 | 619 |
620 #if defined(NDEBUG) | 620 #if defined(NDEBUG) |
621 | 621 |
| 622 BASE_EXPORT extern DcheckState g_dcheck_state; |
| 623 |
| 624 #if defined(DCHECK_ALWAYS_ON) |
| 625 |
| 626 #define DCHECK_IS_ON() true |
| 627 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
| 628 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
| 629 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL |
| 630 const LogSeverity LOG_DCHECK = LOG_FATAL; |
| 631 |
| 632 #else |
| 633 |
622 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 634 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
623 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) | 635 COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) |
624 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT | 636 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT |
625 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; | 637 const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; |
626 BASE_EXPORT extern DcheckState g_dcheck_state; | |
627 #define DCHECK_IS_ON() \ | 638 #define DCHECK_IS_ON() \ |
628 ((::logging::g_dcheck_state == \ | 639 ((::logging::g_dcheck_state == \ |
629 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ | 640 ::logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ |
630 LOG_IS_ON(DCHECK)) | 641 LOG_IS_ON(DCHECK)) |
631 | 642 |
| 643 #endif // defined(DCHECK_ALWAYS_ON) |
| 644 |
632 #else // defined(NDEBUG) | 645 #else // defined(NDEBUG) |
633 | 646 |
634 // On a regular debug build, we want to have DCHECKs enabled. | 647 // On a regular debug build, we want to have DCHECKs enabled. |
635 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 648 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
636 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 649 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
637 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL | 650 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL |
638 const LogSeverity LOG_DCHECK = LOG_FATAL; | 651 const LogSeverity LOG_DCHECK = LOG_FATAL; |
639 #define DCHECK_IS_ON() true | 652 #define DCHECK_IS_ON() true |
640 | 653 |
641 #endif // defined(NDEBUG) | 654 #endif // defined(NDEBUG) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 namespace base { | 956 namespace base { |
944 | 957 |
945 class StringPiece; | 958 class StringPiece; |
946 | 959 |
947 // Allows StringPiece to be logged. | 960 // Allows StringPiece to be logged. |
948 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); | 961 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); |
949 | 962 |
950 } // namespace base | 963 } // namespace base |
951 | 964 |
952 #endif // BASE_LOGGING_H_ | 965 #endif // BASE_LOGGING_H_ |
OLD | NEW |