Added RAY_CHECK with line num and file name for logs

This commit is contained in:
Wapaul1
2016-06-13 00:07:22 +00:00
parent 41539141af
commit 4e885d4896
10 changed files with 111 additions and 236 deletions
+30
View File
@@ -0,0 +1,30 @@
#define RAY_VERBOSE -1
#define RAY_INFO 0
#define RAY_DEBUG 1
#define RAY_FATAL 2
#define RAY_REFCOUNT RAY_VERBOSE
#define RAY_ALIAS RAY_VERBOSE
#define RAY_LOG(LEVEL, MESSAGE) \
if (LEVEL == RAY_VERBOSE) { \
\
} else if (LEVEL == RAY_FATAL) { \
std::cerr << "fatal error occured: " << MESSAGE << std::endl; \
std::exit(1); \
} else if (LEVEL == RAY_DEBUG) { \
\
} else { \
std::cout << MESSAGE << std::endl; \
}
#define RAY_CHECK(condition, message) \
if (!(condition)) {\
RAY_LOG(RAY_FATAL, "Check failed at line " << __LINE__ << " in " << __FILE__ << ": " << #condition << " with message " << message) \
}
#define RAY_CHECK_EQ(var1, var2, message) RAY_CHECK((var1) == (var2), message)
#define RAY_CHECK_NEQ(var1, var2, message) RAY_CHECK((var1) != (var2), message)
#define RAY_CHECK_LE(var1, var2, message) RAY_CHECK((var1) <= (var2), message)
#define RAY_CHECK_LT(var1, var2, message) RAY_CHECK((var1) < (var2), message)
#define RAY_CHECK_GE(var1, var2, message) RAY_CHECK((var1) >= (var2), message)
#define RAY_CHECK_GT(var1, var2, message) RAY_CHECK((var1) > (var2), message)
+1 -19
View File
@@ -3,6 +3,7 @@
#include <vector>
#include <unordered_map>
#include "logging.h"
typedef size_t ObjRef;
typedef size_t WorkerId;
@@ -34,25 +35,6 @@ public:
typedef std::vector<std::vector<ObjStoreId> > ObjTable;
typedef std::unordered_map<std::string, FnInfo> FnTable;
#define RAY_VERBOSE -1
#define RAY_INFO 0
#define RAY_DEBUG 1
#define RAY_FATAL 2
#define RAY_REFCOUNT RAY_VERBOSE
#define RAY_ALIAS RAY_VERBOSE
#define RAY_LOG(LEVEL, MESSAGE) \
if (LEVEL == RAY_VERBOSE) { \
\
} else if (LEVEL == RAY_FATAL) { \
std::cerr << "fatal error occured: " << MESSAGE << std::endl; \
std::exit(1); \
} else if (LEVEL == RAY_DEBUG) { \
\
} else { \
std::cout << MESSAGE << std::endl; \
}
class objstore_not_registered_error : public std::runtime_error
{
public: