1 // Copyright 2017 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef SRC_LOGGING_H_ 6 #define SRC_LOGGING_H_ 7 8 #if defined(BASE_VER) && BASE_VER >= 822064 9 #include "base/check.h" // CHECK-related macros are defined in base/check.h on Chrome OS. 10 #include "base/logging.h" 11 #elif USE_BRILLO 12 #include "base/logging.h" 13 #else 14 #include "glog/logging.h" 15 #endif 16 17 #define TEST_AND_RETURN_FALSE(_x) \ 18 do { \ 19 if (!(_x)) { \ 20 LOG(ERROR) << #_x " failed."; \ 21 return false; \ 22 } \ 23 } while (0) 24 25 #define TEST_AND_RETURN_VALUE(_x, _v) \ 26 do { \ 27 if (!(_x)) { \ 28 LOG(ERROR) << #_x " failed."; \ 29 return (_v); \ 30 } \ 31 } while (0) 32 33 #endif // SRC_LOGGING_H_ 34