2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _SENSOR_LOG_H_
19 #define _SENSOR_LOG_H_
30 #define LOG_TAG "SENSOR"
32 #define LOG_DUMP(fp, fmt, arg...) do { if (fp) fprintf(fp, fmt, ##arg); else _E(fmt, ##arg); } while (0)
37 #define DBG(...) do { } while (0)
48 #define _ERRNO(errno, tag, fmt, arg...) do { \
50 char *error = strerror_r(errno, buf, 1024); \
52 _E("Failed to strerror_r()"); \
55 tag(fmt" (%s[%d])", ##arg, error, errno); \
59 #define warn_if(expr, fmt, arg...) do { \
61 _D("(%s) -> " fmt, #expr, ##arg); \
64 #define ret_if(expr) do { \
66 _D("(%s) -> %s() return", #expr, __FUNCTION__); \
70 #define retv_if(expr, val) do { \
72 _D("(%s) -> %s() return", #expr, __FUNCTION__); \
76 #define retm_if(expr, fmt, arg...) do { \
79 _D("(%s) -> %s() return", #expr, __FUNCTION__); \
83 #define retvm_if(expr, val, fmt, arg...) do { \
86 _D("(%s) -> %s() return", #expr, __FUNCTION__); \
92 #define warn_if(expr, fmt, arg...) do { \
97 #define ret_if(expr) do { \
102 #define retv_if(expr, val) do { \
107 #define retm_if(expr, fmt, arg...) do { \
113 #define retvm_if(expr, val, fmt, arg...) do { \
122 #endif /* _SENSOR_LOG_H_ */