Update logging and check macros. (#1627)

* Update logging and check macros.

* Fix linting.

* Fix RAY_DCHECK and unused variable.

* Fix linting
This commit is contained in:
Robert Nishihara
2018-02-28 15:13:00 -08:00
committed by Philipp Moritz
parent e7df293946
commit 0fcceef772
29 changed files with 721 additions and 774 deletions
+5
View File
@@ -78,4 +78,9 @@ bool UniqueID::operator==(const UniqueID &rhs) const {
return std::memcmp(data(), rhs.data(), kUniqueIDSize) == 0;
}
std::ostream &operator<<(std::ostream &os, const UniqueID &id) {
os << id.hex();
return os;
}
} // namespace ray
+2
View File
@@ -44,6 +44,8 @@ struct UniqueIDHasher {
}
};
std::ostream &operator<<(std::ostream &os, const UniqueID &id);
typedef UniqueID TaskID;
typedef UniqueID JobID;
typedef UniqueID ObjectID;
+14
View File
@@ -34,12 +34,26 @@ namespace ray {
<< __FILE__ << __LINE__ \
<< " Check failed: " #condition " "
#ifdef NDEBUG
#define RAY_DCHECK(condition) \
RAY_IGNORE_EXPR(condition) \
while (false) \
::ray::internal::NullLog()
#else
#define RAY_DCHECK(condition) RAY_CHECK(condition)
#endif // NDEBUG
namespace internal {
class NullLog {
public:
template <class T>
NullLog &operator<<(const T &t) {
RAY_IGNORE_EXPR(t);
return *this;
}
};