Home | History | Annotate | Download | only in 3_4
      1 /*
      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 
     17 #ifndef V4L2_CAMERA_HAL_COMMON_H_
     18 #define V4L2_CAMERA_HAL_COMMON_H_
     19 
     20 #include <cutils/log.h>
     21 
     22 // 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 
     39 #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 
     47 #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 
     59 #endif  // V4L2_CAMERA_HAL_COMMON_H_
     60