1 /* 2 * Copyright (c) 2022-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 16 #ifndef HILOG_WRAPPER_H 17 #define HILOG_WRAPPER_H 18 19 #define CONFIG_HILOG 20 #ifdef CONFIG_HILOG 21 #include "hilog/log.h" 22 23 #ifdef HILOG_FATAL 24 #undef HILOG_FATAL 25 #endif 26 27 #ifdef HILOG_ERROR 28 #undef HILOG_ERROR 29 #endif 30 31 #ifdef HILOG_WARN 32 #undef HILOG_WARN 33 #endif 34 35 #ifdef HILOG_INFO 36 #undef HILOG_INFO 37 #endif 38 39 #ifdef HILOG_DEBUG 40 #undef HILOG_DEBUG 41 #endif 42 43 #ifndef FAF_LOG_DOMAIN 44 #define FAF_LOG_DOMAIN 0xD00430A 45 #endif 46 47 #ifndef FAF_LOG_TAG 48 #define FAF_LOG_TAG "FileAccessFwk" 49 #endif 50 51 #define HILOG_FATAL(fmt, ...) \ 52 ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, FAF_LOG_DOMAIN, FAF_LOG_TAG, \ 53 "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)) 54 #define HILOG_ERROR(fmt, ...) \ 55 ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, FAF_LOG_DOMAIN, FAF_LOG_TAG, \ 56 "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)) 57 #define HILOG_WARN(fmt, ...) \ 58 ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, FAF_LOG_DOMAIN, FAF_LOG_TAG, \ 59 "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)) 60 #define HILOG_INFO(fmt, ...) \ 61 ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, FAF_LOG_DOMAIN, FAF_LOG_TAG, \ 62 "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)) 63 #define HILOG_DEBUG(fmt, ...) \ 64 ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, FAF_LOG_DOMAIN, FAF_LOG_TAG, \ 65 "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)) 66 #else 67 68 #define HILOG_FATAL(...) 69 #define HILOG_ERROR(...) 70 #define HILOG_WARN(...) 71 #define HILOG_INFO(...) 72 #define HILOG_DEBUG(...) 73 #endif // CONFIG_HILOG 74 75 #endif // HILOG_WRAPPER_H