• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Chromium OS Authors. All rights reserved.
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 #ifdef USE_BRILLO
9 #include "base/logging.h"
10 #else
11 #include "glog/logging.h"
12 #endif
13 
14 #define TEST_AND_RETURN_FALSE(_x)   \
15   do {                              \
16     if (!(_x)) {                    \
17       LOG(ERROR) << #_x " failed."; \
18       return false;                 \
19     }                               \
20   } while (0)
21 
22 #define TEST_AND_RETURN_VALUE(_x, _v) \
23   do {                                \
24     if (!(_x)) {                      \
25       LOG(ERROR) << #_x " failed.";   \
26       return (_v);                    \
27     }                                 \
28   } while (0)
29 
30 #endif  // SRC_LOGGING_H_
31