Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: base/logging.h

Issue 2954883002: Add dvlog_always_on to enable DVLOG without DEBUG and DCHECK option
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/logging_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <cassert> 10 #include <cassert>
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 #define CHECK_LT(val1, val2) CHECK_OP(LT, < , val1, val2) 762 #define CHECK_LT(val1, val2) CHECK_OP(LT, < , val1, val2)
763 #define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2) 763 #define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2)
764 #define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2) 764 #define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2)
765 765
766 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 766 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
767 #define DCHECK_IS_ON() 0 767 #define DCHECK_IS_ON() 0
768 #else 768 #else
769 #define DCHECK_IS_ON() 1 769 #define DCHECK_IS_ON() 1
770 #endif 770 #endif
771 771
772 #if defined(NDEBUG) && !defined(DVLOG_ALWAYS_ON)
773 #define DVLOG_IS_ON() 0
774 #else
775 #define DVLOG_IS_ON() 1
776 #endif
777
772 // Definitions for DLOG et al. 778 // Definitions for DLOG et al.
773 779
774 #if DCHECK_IS_ON() 780 #if DCHECK_IS_ON() || DVLOG_IS_ON()
775 781
776 #define DLOG_IS_ON(severity) LOG_IS_ON(severity) 782 #define DLOG_IS_ON(severity) LOG_IS_ON(severity)
777 #define DLOG_IF(severity, condition) LOG_IF(severity, condition) 783 #define DLOG_IF(severity, condition) LOG_IF(severity, condition)
778 #define DLOG_ASSERT(condition) LOG_ASSERT(condition) 784 #define DLOG_ASSERT(condition) LOG_ASSERT(condition)
779 #define DPLOG_IF(severity, condition) PLOG_IF(severity, condition) 785 #define DPLOG_IF(severity, condition) PLOG_IF(severity, condition)
780 #define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition) 786 #define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
781 #define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition) 787 #define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
782 788
783 #else // DCHECK_IS_ON() 789 #else // DCHECK_IS_ON() || DVLOG_IS_ON())
784 790
785 // If !DCHECK_IS_ON(), we want to avoid emitting any references to |condition| 791 // If !DCHECK_IS_ON(), we want to avoid emitting any references to |condition|
786 // (which may reference a variable defined only if DCHECK_IS_ON()). 792 // (which may reference a variable defined only if DCHECK_IS_ON()).
787 // Contrast this with DCHECK et al., which has different behavior. 793 // Contrast this with DCHECK et al., which has different behavior.
788 794
789 #define DLOG_IS_ON(severity) false 795 #define DLOG_IS_ON(severity) false
790 #define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS 796 #define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
791 #define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS 797 #define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS
792 #define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS 798 #define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
793 #define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS 799 #define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
794 #define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS 800 #define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
795 801
796 #endif // DCHECK_IS_ON() 802 #endif // DCHECK_IS_ON() || DVLOG_IS_ON())
797 803
798 #define DLOG(severity) \ 804 #define DLOG(severity) \
799 LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity)) 805 LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
800 806
801 #define DPLOG(severity) \ 807 #define DPLOG(severity) \
802 LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity)) 808 LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
803 809
804 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) 810 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
805 811
806 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) 812 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 #elif NOTIMPLEMENTED_POLICY == 5 1173 #elif NOTIMPLEMENTED_POLICY == 5
1168 #define NOTIMPLEMENTED() do {\ 1174 #define NOTIMPLEMENTED() do {\
1169 static bool logged_once = false;\ 1175 static bool logged_once = false;\
1170 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1176 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1171 logged_once = true;\ 1177 logged_once = true;\
1172 } while(0);\ 1178 } while(0);\
1173 EAT_STREAM_PARAMETERS 1179 EAT_STREAM_PARAMETERS
1174 #endif 1180 #endif
1175 1181
1176 #endif // BASE_LOGGING_H_ 1182 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698