1 /* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef OH_CJ_REQUEST_LOG_H 16 #define OH_CJ_REQUEST_LOG_H 17 18 #include "hilog/log.h" 19 20 #ifdef REQUEST_HILOGF 21 #undef REQUEST_HILOGF 22 #endif 23 24 #ifdef REQUEST_HILOGE 25 #undef REQUEST_HILOGE 26 #endif 27 28 #ifdef REQUEST_HILOGW 29 #undef REQUEST_HILOGW 30 #endif 31 32 #ifdef REQUEST_HILOGD 33 #undef REQUEST_HILOGD 34 #endif 35 36 #ifdef REQUEST_HILOGI 37 #undef REQUEST_HILOGI 38 #endif 39 40 #ifdef LOG_DOMAIN 41 #undef LOG_DOMAIN 42 #endif 43 #ifdef LOG_TAG 44 #undef LOG_TAG 45 #endif 46 47 #define LOG_TAG "CJ-Request" 48 #define LOG_DOMAIN 0xD001C50 49 50 #define MAKE_FILE_NAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 51 52 #define REQUEST_HILOGF(fmt, ...) \ 53 HILOG_FATAL(LOG_CORE, "[%{public}s %{public}s %{public}d] " fmt, \ 54 MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 55 56 #define REQUEST_HILOGE(fmt, ...) \ 57 HILOG_ERROR(LOG_CORE, "[%{public}s %{public}s %{public}d] " fmt, \ 58 MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 59 60 #define REQUEST_HILOGW(fmt, ...) \ 61 HILOG_WARN(LOG_CORE, "[%{public}s %{public}s %{public}d] " fmt, \ 62 MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 63 64 #define REQUEST_HILOGI(fmt, ...) \ 65 HILOG_INFO(LOG_CORE, "[%{public}s %{public}s %{public}d] " fmt, \ 66 MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 67 68 #define REQUEST_HILOGD(fmt, ...) \ 69 HILOG_DEBUG(LOG_CORE, "[%{public}s %{public}s %{public}d] " fmt, \ 70 MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 71 72 #endif /* OH_CJ_REQUEST_LOG_H */