Home | History | Annotate | Download | only in osal
      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 (at) 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 EXYNOS_LOG_OFF
     36 #define EXYNOS_LOG
     37 #endif
     38 
     39 #ifndef EXYNOS_LOG_TAG
     40 #define EXYNOS_LOG_TAG    "EXYNOS_LOG"
     41 #endif
     42 
     43 #ifdef EXYNOS_TRACE_ON
     44 #define EXYNOS_TRACE
     45 #endif
     46 
     47 typedef enum _LOG_LEVEL
     48 {
     49     EXYNOS_LOG_TRACE,
     50     EXYNOS_LOG_INFO,
     51     EXYNOS_LOG_WARNING,
     52     EXYNOS_LOG_ERROR
     53 } EXYNOS_LOG_LEVEL;
     54 
     55 #ifdef EXYNOS_LOG
     56 #define Exynos_OSAL_Log(a, ...)    ((void)_Exynos_OSAL_Log(a, EXYNOS_LOG_TAG, __VA_ARGS__))
     57 #else
     58 #define Exynos_OSAL_Log(a, ...)                                                \
     59     do {                                                                \
     60         if (a == EXYNOS_LOG_ERROR)                                     \
     61             ((void)_Exynos_OSAL_Log(a, EXYNOS_LOG_TAG, __VA_ARGS__)); \
     62     } while (0)
     63 #endif
     64 
     65 #ifdef EXYNOS_TRACE
     66 #define FunctionIn() _Exynos_OSAL_Log(EXYNOS_LOG_TRACE, EXYNOS_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
     67 #define FunctionOut() _Exynos_OSAL_Log(EXYNOS_LOG_TRACE, EXYNOS_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
     68 #else
     69 #define FunctionIn() ((void *)0)
     70 #define FunctionOut() ((void *)0)
     71 #endif
     72 
     73 extern void _Exynos_OSAL_Log(EXYNOS_LOG_LEVEL logLevel, const char *tag, const char *msg, ...);
     74 
     75 #ifdef __cplusplus
     76 }
     77 #endif
     78 
     79 #endif
     80