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

Unified Diff: base/logging.h

Issue 2954883002: Add dvlog_always_on to enable DVLOG without DEBUG and DCHECK option
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/logging_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.h
diff --git a/base/logging.h b/base/logging.h
index 0660e7c158132abec36acd09365ec4781dcd903f..c9b7b0632ab70338fe40ea7036754c48088ebba8 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -769,9 +769,15 @@ DEFINE_CHECK_OP_IMPL(GT, > )
#define DCHECK_IS_ON() 1
#endif
+#if defined(NDEBUG) && !defined(DVLOG_ALWAYS_ON)
+#define DVLOG_IS_ON() 0
+#else
+#define DVLOG_IS_ON() 1
+#endif
+
// Definitions for DLOG et al.
-#if DCHECK_IS_ON()
+#if DCHECK_IS_ON() || DVLOG_IS_ON()
#define DLOG_IS_ON(severity) LOG_IS_ON(severity)
#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
@@ -780,7 +786,7 @@ DEFINE_CHECK_OP_IMPL(GT, > )
#define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
-#else // DCHECK_IS_ON()
+#else // DCHECK_IS_ON() || DVLOG_IS_ON())
// If !DCHECK_IS_ON(), we want to avoid emitting any references to |condition|
// (which may reference a variable defined only if DCHECK_IS_ON()).
@@ -793,7 +799,7 @@ DEFINE_CHECK_OP_IMPL(GT, > )
#define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
#define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
-#endif // DCHECK_IS_ON()
+#endif // DCHECK_IS_ON() || DVLOG_IS_ON())
#define DLOG(severity) \
LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
« 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