fixed svace issues and removed build warnings
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / openmax / osal / Exynos_OSAL_Log.h
1 /*
2  *
3  * Copyright 2012 Samsung Electronics S.LSI Co. LTD
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /*
19  * @file        Exynos_OSAL_Log.h
20  * @brief
21  * @author      Yunji Kim (yunji.kim@samsung.com)
22  * @version     2.0.0
23  * @history
24  *   2012.02.20 : Create
25  *   2012.8.27 : Add trace function
26  */
27
28 #ifndef EXYNOS_OSAL_LOG
29 #define EXYNOS_OSAL_LOG
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #ifndef TIZEN_FEATURE_E3250
36 #ifndef EXYNOS_LOG_OFF
37 #define EXYNOS_LOG
38 #endif
39
40 #ifndef EXYNOS_LOG_TAG
41 #define EXYNOS_LOG_TAG    "EXYNOS_LOG"
42 #endif
43
44 #ifdef EXYNOS_TRACE_ON
45 #define EXYNOS_TRACE
46 #endif
47 #endif /* TIZEN_FEATURE_E3250 */
48
49 typedef enum _LOG_LEVEL
50 {
51 #ifdef TIZEN_FEATURE_E3250
52     EXYNOS_LOG_VERVOSE,
53 #endif
54     EXYNOS_LOG_TRACE,
55     EXYNOS_LOG_INFO,
56     EXYNOS_LOG_WARNING,
57     EXYNOS_LOG_ERROR
58 } EXYNOS_LOG_LEVEL;
59
60 #ifndef TIZEN_FEATURE_E3250
61
62 #ifdef EXYNOS_LOG
63 #define Exynos_OSAL_Log(a, ...)    ((void)_Exynos_OSAL_Log(a, EXYNOS_LOG_TAG, __VA_ARGS__))
64 #else
65 #define Exynos_OSAL_Log(a, ...)                                                \
66     do {                                                                \
67         if (a == EXYNOS_LOG_ERROR)                                     \
68             ((void)_Exynos_OSAL_Log(a, EXYNOS_LOG_TAG, __VA_ARGS__)); \
69     } while (0)
70 #endif
71
72 #ifdef EXYNOS_TRACE
73 #define FunctionIn() _Exynos_OSAL_Log(EXYNOS_LOG_TRACE, EXYNOS_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
74 #define FunctionOut() _Exynos_OSAL_Log(EXYNOS_LOG_TRACE, EXYNOS_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
75 #else
76 #define FunctionIn() ((void *)0)
77 #define FunctionOut() ((void *)0)
78 #endif
79
80 #else /* TIZEN_FEATURE_E3250 */
81
82 #define OMX_DEBUG_LEVEL 2 /* EXYNOS_LOG_INFO */
83
84 #undef ALOGV
85 #define ALOGV(...) Exynos_OSAL_Log(EXYNOS_LOG_VERVOSE, __VA_ARGS__)
86 #undef ALOGD
87 #define ALOGD(...) Exynos_OSAL_Log(EXYNOS_LOG_TRACE, __VA_ARGS__)
88 #undef ALOGI
89 #define ALOGI(...) Exynos_OSAL_Log(EXYNOS_LOG_INFO, __VA_ARGS__)
90 #undef ALOGW
91 #define ALOGW(...) Exynos_OSAL_Log(EXYNOS_LOG_WARNING, __VA_ARGS__)
92 #undef ALOGE
93 #define ALOGE(...) Exynos_OSAL_Log(EXYNOS_LOG_ERROR, __VA_ARGS__)
94
95 #ifndef EXYNOS_LOG_TAG
96 #define Exynos_OSAL_Log(a, ...) _Exynos_OSAL_Log(a, "EXYNOS_LOG", __VA_ARGS__)
97 #define FunctionIn() _Exynos_OSAL_Log(EXYNOS_LOG_VERVOSE, "EXYNOS_LOG", "%s In , Line: %d", __FUNCTION__, __LINE__)
98 #define FunctionOut() _Exynos_OSAL_Log(EXYNOS_LOG_VERVOSE, "EXYNOS_LOG", "%s Out , Line: %d", __FUNCTION__, __LINE__)
99 #else
100 #define Exynos_OSAL_Log(a, ...) _Exynos_OSAL_Log(a, EXYNOS_LOG_TAG, EXYNOS_LOG_TAG"] "__VA_ARGS__)
101 #define FunctionIn() _Exynos_OSAL_Log(EXYNOS_LOG_VERVOSE, EXYNOS_LOG_TAG, EXYNOS_LOG_TAG"] %s In , Line: %d", __FUNCTION__, __LINE__)
102 #define FunctionOut() _Exynos_OSAL_Log(EXYNOS_LOG_VERVOSE, EXYNOS_LOG_TAG, EXYNOS_LOG_TAG"] %s Out , Line: %d", __FUNCTION__, __LINE__)
103 #endif
104
105 #endif /* TIZEN_FEATURE_E3250 */
106
107 extern void _Exynos_OSAL_Log(EXYNOS_LOG_LEVEL logLevel, const char *tag, const char *msg, ...);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif