1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef AUDIO_DRIVER_LOG_H 10 #define AUDIO_DRIVER_LOG_H 11 #include "hdf_log.h" 12 13 #ifdef __cplusplus 14 #if __cplusplus 15 extern "C" { 16 #endif 17 #endif /* __cplusplus */ 18 19 // 1 is on; 0 is off 20 #define AUDIO_ADM_DEBUG_ON 0 21 #define AUDIO_DRIVER_DEBUG_ON 0 22 #define AUDIO_DEVICE_DEBUG_ON 0 23 24 // audio ADM log define 25 #ifdef __LITEOS__ 26 #define ADM_LOG_DEBUG(fmt, arg...) do { \ 27 } while (0) 28 #elif AUDIO_ADM_DEBUG_ON 29 #define ADM_LOG_DEBUG(fmt, arg...) do { \ 30 HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 31 } while (0) 32 #else 33 #define ADM_LOG_DEBUG(fmt, arg...) do { \ 34 } while (0) 35 #endif 36 37 #define ADM_LOG_ERR(fmt, arg...) do { \ 38 HDF_LOGE("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 39 } while (0) 40 41 #define ADM_LOG_INFO(fmt, arg...) do { \ 42 HDF_LOGI("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 43 } while (0) 44 45 #define ADM_LOG_WARNING(fmt, arg...) do { \ 46 HDF_LOGW("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 47 } while (0) 48 49 // audio driver log define 50 #ifdef __LITEOS__ 51 #define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ 52 } while (0) 53 #elif AUDIO_DRIVER_DEBUG_ON 54 #define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ 55 HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 56 } while (0) 57 #else 58 #define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ 59 } while (0) 60 #endif 61 62 #define AUDIO_DRIVER_LOG_ERR(fmt, arg...) do { \ 63 HDF_LOGE("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 64 } while (0) 65 66 #define AUDIO_DRIVER_LOG_INFO(fmt, arg...) do { \ 67 HDF_LOGI("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 68 } while (0) 69 70 #define AUDIO_DRIVER_LOG_WARNING(fmt, arg...) do { \ 71 HDF_LOGW("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 72 } while (0) 73 74 // audio device log define 75 #ifdef __LITEOS__ 76 #define AUDIO_DEVICE_LOG_DEBUG(fmt, arg...) do { \ 77 } while (0) 78 #elif AUDIO_DEVICE_DEBUG_ON 79 #define AUDIO_DEVICE_LOG_DEBUG(fmt, arg...) do { \ 80 HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 81 } while (0) 82 #else 83 #define AUDIO_DEVICE_LOG_DEBUG(fmt, arg...) do { \ 84 } while (0) 85 #endif 86 87 #define AUDIO_DEVICE_LOG_ERR(fmt, arg...) do { \ 88 HDF_LOGE("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 89 } while (0) 90 91 #define AUDIO_DEVICE_LOG_INFO(fmt, arg...) do { \ 92 HDF_LOGI("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 93 } while (0) 94 95 #define AUDIO_DEVICE_LOG_WARNING(fmt, arg...) do { \ 96 HDF_LOGW("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ 97 } while (0) 98 99 #ifdef __cplusplus 100 #if __cplusplus 101 } 102 #endif 103 #endif /* __cplusplus */ 104 105 #endif /* AUDIO_DRIVER_LOG_H */ 106