Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing debug-logging macros #986

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -1214,6 +1216,14 @@ const LogSeverity GLOG_0 = GLOG_ERROR;
static_cast<void>(0), \
(true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)

#define DLOG_FIRST_N(severity, n) \
static_cast<void>(0), \
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)

#define DLOG_EVERY_T(severity, T) \
static_cast<void>(0), \
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)

#define DLOG_ASSERT(condition) \
static_cast<void>(0), \
true ? (void) 0 : LOG_ASSERT(condition)
Expand Down