b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | |
| 2 | |
| 3 | #ifndef _UTILS_LOG_H_ |
| 4 | #define _UTILS_LOG_H_ |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <string.h> |
| 8 | #include <errno.h> |
| 9 | |
| 10 | #if defined(USE_LOGCAT) |
| 11 | #include <include/log.h> |
| 12 | #include "diag_API.h" |
| 13 | #undef LOGD |
| 14 | #undef LOGE |
| 15 | #undef LOGI |
| 16 | #undef LOGV |
| 17 | #undef LOGW |
| 18 | #undef ALOGD |
| 19 | #undef ALOGE |
| 20 | #undef ALOGI |
| 21 | #undef ALOGV |
| 22 | #undef ALOGW |
| 23 | |
| 24 | #define LOGD(CAT, format, args...) RLOG_DBG(AUDIO, CAT, format, ##args) |
| 25 | #define LOGE(CAT, format, args...) RLOG_ERROR(AUDIO, CAT, format, ##args) |
| 26 | #define LOGI(CAT, format, args...) RLOG_INFO(AUDIO, CAT, format, ##args) |
| 27 | #define LOGV(CAT, format, args...) RLOG_DBG(AUDIO, CAT, format, ##args) |
| 28 | #define LOGW(CAT, format, args...) RLOG_WARN(AUDIO, CAT, format, ##args) |
| 29 | #define ALOGV LOGV |
| 30 | #define ALOGD LOGD |
| 31 | #define ALOGI LOGI |
| 32 | #define ALOGW LOGW |
| 33 | #define ALOGE LOGE |
| 34 | |
| 35 | #elif defined(USE_ACM_LOG) |
| 36 | #include "acm_log.h" |
| 37 | |
| 38 | #else |
| 39 | #define LOGV(...) /*nothing*/ |
| 40 | #define LOGD(...) /*nothing*/ |
| 41 | #define LOGI(...) /*nothing*/ |
| 42 | #define LOGW(...) /*nothing*/ |
| 43 | #define LOGE(...) /*nothing*/ |
| 44 | #define ALOGV LOGV |
| 45 | #define ALOGD LOGD |
| 46 | #define ALOGI LOGI |
| 47 | #define ALOGW LOGW |
| 48 | #define ALOGE LOGE |
| 49 | #endif |
| 50 | |
| 51 | |
| 52 | /* The snprintf() is not "always" implemented and present in <stdio.h>: |
| 53 | * int snprintf(char *str, size_t size, const char *format, ...); |
| 54 | * Let's re-define it into sprintf() |
| 55 | */ |
| 56 | int snprintf(char *str, size_t size, const char *format, ...); |
| 57 | |
| 58 | #endif /*_UTILS_LOG_H_*/ |