From 716be9edc7e25d6f242489a7364028747bc569ed Mon Sep 17 00:00:00 2001 From: Acey <69460051+4c3y@users.noreply.github.com> Date: Thu, 21 Dec 2023 10:45:06 -0800 Subject: [PATCH] feat: add missing debug logging macros (#986) --- README.rst | 2 ++ src/glog/logging.h.in | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.rst b/README.rst index 37ad740..87f3da6 100644 --- a/README.rst +++ b/README.rst @@ -388,6 +388,8 @@ excessive logging. DLOG(INFO) << "Found cookies"; DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; + DLOG_FIRST_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; + DLOG_EVERY_T(INFO, 0.01) << "Got a cookie"; ``CHECK`` Macros diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index cf88ccb..f878231 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -1175,6 +1175,8 @@ const LogSeverity GLOG_0 = GLOG_ERROR; #define DLOG_EVERY_N(severity, n) LOG_EVERY_N(severity, n) #define DLOG_IF_EVERY_N(severity, condition, n) \ LOG_IF_EVERY_N(severity, condition, n) +#define DLOG_FIRST_N(severity, n) LOG_FIRST_N(severity, n) +#define DLOG_EVERY_T(severity, T) LOG_EVERY_T(severity, T) #define DLOG_ASSERT(condition) LOG_ASSERT(condition) // debug-only checking. executed if DCHECK_IS_ON(). @@ -1214,6 +1216,14 @@ const LogSeverity GLOG_0 = GLOG_ERROR; static_cast(0), \ (true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) +#define DLOG_FIRST_N(severity, n) \ + static_cast(0), \ + true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + +#define DLOG_EVERY_T(severity, T) \ + static_cast(0), \ + true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity) + #define DLOG_ASSERT(condition) \ static_cast(0), \ true ? (void) 0 : LOG_ASSERT(condition)