1413470f0Sopenharmony_ci/* 2413470f0Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3413470f0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4413470f0Sopenharmony_ci * you may not use this file except in compliance with the License. 5413470f0Sopenharmony_ci * You may obtain a copy of the License at 6413470f0Sopenharmony_ci * 7413470f0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8413470f0Sopenharmony_ci * 9413470f0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10413470f0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11413470f0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12413470f0Sopenharmony_ci * See the License for the specific language governing permissions and 13413470f0Sopenharmony_ci * limitations under the License. 14413470f0Sopenharmony_ci */ 15413470f0Sopenharmony_ci 16413470f0Sopenharmony_ci#ifndef POWERMGR_HILOG_WRAPPER_H 17413470f0Sopenharmony_ci#define POWERMGR_HILOG_WRAPPER_H 18413470f0Sopenharmony_ci 19413470f0Sopenharmony_ci#define LOG_TAG "BatteryMgr" 20413470f0Sopenharmony_ci 21413470f0Sopenharmony_ci#include <log.h> 22413470f0Sopenharmony_ci 23413470f0Sopenharmony_ci#ifdef __cplusplus 24413470f0Sopenharmony_ciextern "C" { 25413470f0Sopenharmony_ci#endif // __cplusplus 26413470f0Sopenharmony_ci 27413470f0Sopenharmony_ci#define FILE_NAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 28413470f0Sopenharmony_ci#define FILE_FORMATED(fmt, ...) "[%s] %s# " fmt, FILE_NAME, __FUNCTION__, ##__VA_ARGS__ 29413470f0Sopenharmony_ci 30413470f0Sopenharmony_ci#ifdef POWER_HILOGD 31413470f0Sopenharmony_ci#undef POWER_HILOGD 32413470f0Sopenharmony_ci#endif 33413470f0Sopenharmony_ci 34413470f0Sopenharmony_ci#ifdef POWER_HILOGI 35413470f0Sopenharmony_ci#undef POWER_HILOGI 36413470f0Sopenharmony_ci#endif 37413470f0Sopenharmony_ci 38413470f0Sopenharmony_ci#ifdef POWER_HILOGW 39413470f0Sopenharmony_ci#undef POWER_HILOGW 40413470f0Sopenharmony_ci#endif 41413470f0Sopenharmony_ci 42413470f0Sopenharmony_ci#ifdef POWER_HILOGE 43413470f0Sopenharmony_ci#undef POWER_HILOGE 44413470f0Sopenharmony_ci#endif 45413470f0Sopenharmony_ci 46413470f0Sopenharmony_ci#ifdef POWER_HILOGF 47413470f0Sopenharmony_ci#undef POWER_HILOGF 48413470f0Sopenharmony_ci#endif 49413470f0Sopenharmony_ci 50413470f0Sopenharmony_ci#ifdef __LITEOS_M__ 51413470f0Sopenharmony_ci#define POWER_HILOGD(...) HILOG_DEBUG(HILOG_MODULE_POWERMGR, __VA_ARGS__) 52413470f0Sopenharmony_ci#define POWER_HILOGI(...) HILOG_INFO(HILOG_MODULE_POWERMGR, __VA_ARGS__) 53413470f0Sopenharmony_ci#define POWER_HILOGW(...) HILOG_WARN(HILOG_MODULE_POWERMGR, __VA_ARGS__) 54413470f0Sopenharmony_ci#define POWER_HILOGE(...) HILOG_ERROR(HILOG_MODULE_POWERMGR, __VA_ARGS__) 55413470f0Sopenharmony_ci#define POWER_HILOGF(...) HILOG_FATAL(HILOG_MODULE_POWERMGR, __VA_ARGS__) 56413470f0Sopenharmony_ci#else // !__LITEOS_M__ 57413470f0Sopenharmony_ci#define POWER_HILOGD(...) HILOG_DEBUG(LOG_CORE, FILE_FORMATED(__VA_ARGS__)) 58413470f0Sopenharmony_ci#define POWER_HILOGI(...) HILOG_INFO(LOG_CORE, FILE_FORMATED(__VA_ARGS__)) 59413470f0Sopenharmony_ci#define POWER_HILOGW(...) HILOG_WARN(LOG_CORE, FILE_FORMATED(__VA_ARGS__)) 60413470f0Sopenharmony_ci#define POWER_HILOGE(...) HILOG_ERROR(LOG_CORE, FILE_FORMATED(__VA_ARGS__)) 61413470f0Sopenharmony_ci#define POWER_HILOGF(...) HILOG_FATAL(LOG_CORE, FILE_FORMATED(__VA_ARGS__)) 62413470f0Sopenharmony_ci#endif // __LITEOS_M__ 63413470f0Sopenharmony_ci 64413470f0Sopenharmony_ci#ifdef __cplusplus 65413470f0Sopenharmony_ci} 66413470f0Sopenharmony_ci#endif // __cplusplus 67413470f0Sopenharmony_ci#endif // POWERMGR_HILOG_WRAPPER_H 68