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