diff options
author | Benjamin Barenblat <bbaren@google.com> | 2021-07-06 19:57:09 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2021-07-06 19:57:09 -0400 |
commit | fe480f5e29f212efd5b933475cc6e71fc5937f4d (patch) | |
tree | fc274e0a34ea889f6933618393533fdcfa188a65 /log.h | |
parent | bbec3b57e296543c5005b93ad1d74c6e3ad34a40 (diff) |
Add CHECK macro to logging framework
Reviewed-by: Alex Chernyakhovsky <achernya@google.com>
Diffstat (limited to 'log.h')
-rw-r--r-- | log.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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_ |