1 /* 2 * Copyright (c) 2022 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 FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_COMMON_INCLUDE_BGTASKMGR_LOG_WRAPPER_H 17 #define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_COMMON_INCLUDE_BGTASKMGR_LOG_WRAPPER_H 18 19 #include "hilog/log.h" 20 21 #ifdef LOG_DOMAIN 22 #undef LOG_DOMAIN 23 #endif 24 #define LOG_DOMAIN 0xD001711 25 26 #ifdef LOG_TAG 27 #undef LOG_TAG 28 #endif 29 #define LOG_TAG "BACKGROUND_TASK" 30 31 namespace OHOS { 32 namespace BackgroundTaskMgr { 33 34 #ifndef FORMAT_LOG 35 #define FORMAT_LOG(fmt, ...) "[%{public}s:%{public}d] " fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__ 36 #endif 37 38 #define BACKGROUND_TASK_PRINT_LOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__) 39 #define BACKGROUND_TASK_PRINT_LOGI(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__) 40 #define BACKGROUND_TASK_PRINT_LOGW(fmt, ...) HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__) 41 #define BACKGROUND_TASK_PRINT_LOGE(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__) 42 #define BACKGROUND_TASK_PRINT_LOGF(fmt, ...) HILOG_FATAL(LOG_CORE, fmt, ##__VA_ARGS__) 43 44 #define BGTASK_LOGD(...) BACKGROUND_TASK_PRINT_LOGD(FORMAT_LOG(__VA_ARGS__)) 45 #define BGTASK_LOGI(...) BACKGROUND_TASK_PRINT_LOGI(FORMAT_LOG(__VA_ARGS__)) 46 #define BGTASK_LOGW(...) BACKGROUND_TASK_PRINT_LOGW(FORMAT_LOG(__VA_ARGS__)) 47 #define BGTASK_LOGE(...) BACKGROUND_TASK_PRINT_LOGE(FORMAT_LOG(__VA_ARGS__)) 48 #define BGTASK_LOGF(...) BACKGROUND_TASK_PRINT_LOGF(FORMAT_LOG(__VA_ARGS__)) 49 } // namespace BackgroundTaskMgr 50 } // namespace OHOS 51 #endif // FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_COMMON_INCLUDE_BGTASKMGR_LOG_WRAPPER_H