-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging.h
More file actions
29 lines (25 loc) · 1.44 KB
/
logging.h
File metadata and controls
29 lines (25 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef COM_WEBSTER_MIMMON_LOGGING_H_
#define COM_WEBSTER_MIMMON_LOGGING_H_
#include <cstdlib>
#include <iostream>
#include <ostream>
#define CHECK(condition) \
do { \
if (!(condition)) { \
std::cerr << __builtin_FILE() << ":" << __builtin_LINE() \
<< "] Check failed: " << #condition << std::endl; \
std::abort(); \
} \
} while (0)
#define PCHECK(condition) \
do { \
if (!(condition)) { \
const auto saved_errno = errno; \
std::cerr << __builtin_FILE() << ":" << __builtin_LINE() \
<< "] Check failed: " << #condition << " (" \
<< std::strerror(saved_errno) << " [" << saved_errno << "])" \
<< std::endl; \
std::abort(); \
} \
} while (0)
#endif // COM_WEBSTER_MIMMON_LOGGING_H_