mirror of
https://github.com/wassname/ray.git
synced 2026-08-11 11:24:51 +08:00
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:
committed by
Philipp Moritz
parent
e7df293946
commit
0fcceef772
@@ -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
|
||||
|
||||
@@ -44,6 +44,8 @@ struct UniqueIDHasher {
|
||||
}
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const UniqueID &id);
|
||||
|
||||
typedef UniqueID TaskID;
|
||||
typedef UniqueID JobID;
|
||||
typedef UniqueID ObjectID;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user