aboutsummaryrefslogtreecommitdiff
path: root/log.h
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2021-07-06 19:57:09 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2021-07-06 19:57:09 -0400
commitfe480f5e29f212efd5b933475cc6e71fc5937f4d (patch)
treefc274e0a34ea889f6933618393533fdcfa188a65 /log.h
parentbbec3b57e296543c5005b93ad1d74c6e3ad34a40 (diff)
Add CHECK macro to logging framework
Reviewed-by: Alex Chernyakhovsky <achernya@google.com>
Diffstat (limited to 'log.h')
-rw-r--r--log.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/log.h b/log.h
index e0d3963..d588b8f 100644
--- a/log.h
+++ b/log.h
@@ -111,6 +111,14 @@ void Log::Message(Level level, Args... args) {
out_->write(message.data(), message.size());
}
+// If condition is false, logs an internal error and exits the program.
+void Check(Log& log, bool condition, const char* condition_str,
+ const char* file, int line);
+
} // namespace gsrsup
+// A convenience macro to invoke the Check function.
+#define CHECK(log, condition) \
+ ::gsrsup::Check((log), (condition), #condition, __FILE__, __LINE__)
+
#endif // GSRSUP_LOG_H_