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