1 /* 2 * Copyright (c) 2021 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 HIDUMPER_UTILS_HILOG_WRAPPER_H 16 #define HIDUMPER_UTILS_HILOG_WRAPPER_H 17 #define CONFIG_HILOG 18 #ifdef CONFIG_HILOG 19 #include "hilog/log.h" 20 namespace OHOS { 21 namespace HiviewDFX { 22 #ifdef DUMPER_HILOGF 23 #undef DUMPER_HILOGF 24 #endif 25 #ifdef DUMPER_HILOGE 26 #undef DUMPER_HILOGE 27 #endif 28 #ifdef DUMPER_HILOGW 29 #undef DUMPER_HILOGW 30 #endif 31 #ifdef DUMPER_HILOGI 32 #undef DUMPER_HILOGI 33 #endif 34 #ifdef DUMPER_HILOGD 35 #undef DUMPER_HILOGD 36 #endif 37 38 // 0xD002D20: subsystem:DumperMgr module:DumperManager, 8 bits reserved. 39 #undef LOG_DOMAIN 40 #define LOG_DOMAIN 0xD002D20 41 #undef LOG_TAG 42 #define LOG_TAG "DumperService" 43 44 #define DUMPER_HILOGF(module, fmt, ...) \ 45 HILOG_FATAL(LOG_CORE, "%{public}s# " fmt, __FUNCTION__, ##__VA_ARGS__) 46 #define DUMPER_HILOGE(module, fmt, ...) \ 47 HILOG_ERROR(LOG_CORE, "%{public}s# " fmt, __FUNCTION__, ##__VA_ARGS__) 48 #define DUMPER_HILOGW(module, fmt, ...) \ 49 HILOG_WARN(LOG_CORE, "%{public}s# " fmt, __FUNCTION__, ##__VA_ARGS__) 50 #define DUMPER_HILOGI(module, fmt, ...) \ 51 HILOG_INFO(LOG_CORE, "%{public}s# " fmt, __FUNCTION__, ##__VA_ARGS__) 52 #define DUMPER_HILOGD(module, fmt, ...) \ 53 HILOG_DEBUG(LOG_CORE, "%{public}s# " fmt, __FUNCTION__, ##__VA_ARGS__) 54 } // namespace HiviewDFX 55 } // namespace OHOS 56 #else 57 #define DUMPER_HILOGF(...) 58 #define DUMPER_HILOGE(...) 59 #define DUMPER_HILOGW(...) 60 #define DUMPER_HILOGI(...) 61 #define DUMPER_HILOGD(...) 62 #endif // CONFIG_HILOG 63 #endif // HIDUMPER_UTILS_HILOG_WRAPPER_H 64