aboutsummaryrefslogtreecommitdiff
path: root/log.cc
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.cc
parentbbec3b57e296543c5005b93ad1d74c6e3ad34a40 (diff)
Add CHECK macro to logging framework
Reviewed-by: Alex Chernyakhovsky <achernya@google.com>
Diffstat (limited to 'log.cc')
-rw-r--r--log.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/log.cc b/log.cc
new file mode 100644
index 0000000..13b74d7
--- /dev/null
+++ b/log.cc
@@ -0,0 +1,17 @@
+#include "log.h"
+
+#include <absl/strings/substitute.h>
+#include <stdlib.h>
+
+namespace gsrsup {
+
+void Check(Log& log, bool condition, const char* condition_str,
+ const char* file, int line) {
+ if (!condition) {
+ log.Error(absl::Substitute("internal error ($0:$1): ", file, line),
+ condition_str);
+ exit(1);
+ }
+}
+
+} // namespace gsrsup