@@ -540,6 +540,12 @@ class LogSink; // defined below
540
540
? (void )0 \
541
541
: google::logging::internal::LogMessageVoidify() & SYSLOG (severity)
542
542
543
+ #define LOG_TO_SINK_IF (sink, severity, condition ) \
544
+ static_cast <void >(0 ), \
545
+ !(condition) \
546
+ ? (void )0 \
547
+ : google::logging::internal::LogMessageVoidify() & LOG_TO_SINK (sink, severity)
548
+
543
549
#define LOG_ASSERT (condition ) \
544
550
LOG_IF (FATAL, !(condition)) << "Assert failed: " #condition
545
551
#define SYSLOG_ASSERT (condition ) \
@@ -1019,6 +1025,7 @@ constexpr LogSeverity GLOG_0 = GLOG_ERROR;
1019
1025
# define DLOG_FIRST_N (severity, n ) LOG_FIRST_N(severity, n)
1020
1026
# define DLOG_EVERY_T (severity, T ) LOG_EVERY_T(severity, T)
1021
1027
# define DLOG_ASSERT (condition ) LOG_ASSERT(condition)
1028
+ # define DLOG_TO_SINK (sink, severity ) LOG_TO_SINK(sink, severity)
1022
1029
1023
1030
// debug-only checking. executed if DCHECK_IS_ON().
1024
1031
# define DCHECK (condition ) CHECK(condition)
@@ -1077,6 +1084,11 @@ constexpr LogSeverity GLOG_0 = GLOG_ERROR;
1077
1084
# define DLOG_ASSERT (condition ) \
1078
1085
static_cast <void >(0 ), true ? (void )0 : (LOG_ASSERT(condition))
1079
1086
1087
+ # define DLOG_TO_SINK (sink, severity ) \
1088
+ static_cast <void >(0 ), \
1089
+ true ? (void )0 \
1090
+ : google::logging::internal::LogMessageVoidify() & LOG (severity)
1091
+
1080
1092
// MSVC warning C4127: conditional expression is constant
1081
1093
# define DCHECK (condition ) \
1082
1094
GLOG_MSVC_PUSH_DISABLE_WARNING (4127 ) \
0 commit comments