blob: 48cf2bd4a7299f6648a300bc37f2bf3f39e88cc2 [file] [log] [blame]
Ari Hausman-Cohen73442152016-06-08 15:50:49 -07001/*
2 * Copyright 2015 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
Ari Hausman-Cohen3841a7f2016-07-19 17:27:52 -070017#ifndef V4L2_CAMERA_HAL_COMMON_H_
18#define V4L2_CAMERA_HAL_COMMON_H_
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070019
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070020#include <cutils/log.h>
21
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070022// Helpers of logging (showing function name and line number).
23#define HAL_LOGE(fmt, args...) do { \
24 ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args); \
25 } while(0)
26
27#define HAL_LOGE_IF(cond, fmt, args...) do { \
28 ALOGE_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \
29 } while(0)
30
31#define HAL_LOGW(fmt, args...) do { \
32 ALOGW("%s:%d: " fmt, __func__, __LINE__, ##args); \
33 } while(0)
34
35#define HAL_LOGW_IF(cond, fmt, args...) do { \
36 ALOGW_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \
37 } while(0)
38
Ari Hausman-Cohenad6fe2b2016-11-16 10:48:07 -080039#define HAL_LOGI(fmt, args...) do { \
40 ALOGI("%s:%d: " fmt, __func__, __LINE__, ##args); \
41 } while(0)
42
43#define HAL_LOGI_IF(cond, fmt, args...) do { \
44 ALOGI_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \
45 } while(0)
46
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070047#define HAL_LOGD(fmt, args...) do { \
48 ALOGD("%s:%d: " fmt, __func__, __LINE__, ##args); \
49 } while(0)
50
51#define HAL_LOGV(fmt, args...) do { \
52 ALOGV("%s:%d: " fmt, __func__, __LINE__, ##args); \
53 } while(0)
54
55// Log enter/exit of methods.
56#define HAL_LOG_ENTER() HAL_LOGV("enter")
57#define HAL_LOG_EXIT() HAL_LOGV("exit")
58
Ari Hausman-Cohen3841a7f2016-07-19 17:27:52 -070059#endif // V4L2_CAMERA_HAL_COMMON_H_