blob: 05eed195082fe7ce511738ad213b9e1a9ca1c7d9
1 | /* |
2 | * Copyright (C) 2011 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 | |
17 | /* |
18 | use "dumpsys media.camera -t x" to change log level to x or |
19 | use "adb shell dumpsys media.camera -t x" to change log level to x |
20 | */ |
21 | |
22 | #ifndef DEBUG_UTILS_H |
23 | #define DEBUG_UTILS_H |
24 | #include <stdint.h> |
25 | |
26 | //Uncomment to enable more verbose/debug logs |
27 | #define DEBUG_LOG |
28 | extern volatile int32_t gCamHal_LogLevel; |
29 | |
30 | ///Camera HAL Logging Functions |
31 | #ifndef DEBUG_LOG |
32 | |
33 | #define CAMHAL_LOGDA(str) |
34 | #define CAMHAL_LOGDB(str, ...) |
35 | #define CAMHAL_LOGVA(str) |
36 | #define CAMHAL_LOGVB(str, ...) |
37 | |
38 | #define CAMHAL_LOGIA ALOGD |
39 | #define CAMHAL_LOGIB ALOGD |
40 | #define CAMHAL_LOGWA ALOGE |
41 | #define CAMHAL_LOGWB ALOGE |
42 | #define CAMHAL_LOGEA ALOGE |
43 | #define CAMHAL_LOGEB ALOGE |
44 | #define CAMHAL_LOGFA ALOGE |
45 | #define CAMHAL_LOGFB ALOGE |
46 | |
47 | #undef LOG_FUNCTION_NAME |
48 | #undef LOG_FUNCTION_NAME_EXIT |
49 | #define LOG_FUNCTION_NAME |
50 | #define LOG_FUNCTION_NAME_EXIT |
51 | |
52 | #else |
53 | |
54 | ///Defines for debug statements - Macro LOG_TAG needs to be defined in the respective files |
55 | #define CAMHAL_LOGVA(str) ALOGV_IF(gCamHal_LogLevel >=6,"%5d %s - " str, __LINE__,__FUNCTION__); |
56 | #define CAMHAL_LOGVB(str,...) ALOGV_IF(gCamHal_LogLevel >=6,"%5d %s - " str, __LINE__, __FUNCTION__, __VA_ARGS__); |
57 | #define CAMHAL_LOGDA(str) ALOGD_IF(gCamHal_LogLevel >=5,"%5d %s - " str, __LINE__,__FUNCTION__); |
58 | #define CAMHAL_LOGDB(str, ...) ALOGD_IF(gCamHal_LogLevel >=5,"%5d %s - " str, __LINE__, __FUNCTION__, __VA_ARGS__); |
59 | #define CAMHAL_LOGIA(str) ALOGI_IF(gCamHal_LogLevel >=4,"%5d %s - " str, __LINE__, __FUNCTION__); |
60 | #define CAMHAL_LOGIB(str, ...) ALOGI_IF(gCamHal_LogLevel >=4,"%5d %s - " str, __LINE__,__FUNCTION__, __VA_ARGS__); |
61 | #define CAMHAL_LOGWA(str) ALOGW_IF(gCamHal_LogLevel >=3,"%5d %s - " str, __LINE__, __FUNCTION__); |
62 | #define CAMHAL_LOGWB(str, ...) ALOGW_IF(gCamHal_LogLevel >=3,"%5d %s - " str, __LINE__,__FUNCTION__, __VA_ARGS__); |
63 | #define CAMHAL_LOGEA(str) ALOGE_IF(gCamHal_LogLevel >=2,"%5d %s - " str, __LINE__, __FUNCTION__); |
64 | #define CAMHAL_LOGEB(str, ...) ALOGE_IF(gCamHal_LogLevel >=2,"%5d %s - " str, __LINE__,__FUNCTION__, __VA_ARGS__); |
65 | #define CAMHAL_LOGFA(str) ALOGF_IF(gCamHal_LogLevel >=1,"%5d %s - " str, __LINE__, __FUNCTION__); |
66 | #define CAMHAL_LOGFB(str, ...) ALOGF_IF(gCamHal_LogLevel >=1,"%5d %s - " str, __LINE__,__FUNCTION__, __VA_ARGS__); |
67 | |
68 | #define LOG_FUNCTION_NAME CAMHAL_LOGVA("ENTER"); |
69 | #define LOG_FUNCTION_NAME_EXIT CAMHAL_LOGVA("EXIT"); |
70 | #define DBG_LOGA(str) ALOGI_IF(gCamHal_LogLevel >=4,"%10s-%5d %s - " str, CAMHAL_BUILD_NAME, __LINE__,__FUNCTION__) |
71 | #define DBG_LOGB(str, ...) ALOGI_IF(gCamHal_LogLevel >=4,"%10s-%5d %s - " str, CAMHAL_BUILD_NAME, __LINE__,__FUNCTION__, __VA_ARGS__); |
72 | |
73 | #endif |
74 | |
75 | #endif //DEBUG_UTILS_H |
76 |