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 
16 #ifndef HILOG_WRAPPER_H
17 #define HILOG_WRAPPER_H
18 
19 #undef RESMGR_TAG
20 #define RESMGR_TAG "ResourceManager"
21 
22 #undef RESMGR_JS_TAG
23 #define RESMGR_JS_TAG "ResourceManagerJs"
24 
25 #undef RESMGR_NATIVE_TAG
26 #define RESMGR_NATIVE_TAG "ResourceManagerNative"
27 
28 #undef RESMGR_RAWFILE_TAG
29 #define RESMGR_RAWFILE_TAG "ResourceManagerRawFile"
30 
31 #ifdef CONFIG_HILOG
32 
33 #include "hilog/log.h"
34 
35 namespace OHOS::HiviewDFX {
36     #define RESMGR_HILOGE(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_ERROR, 0xD001E00, tag, fmt, ##__VA_ARGS__)
37     #define RESMGR_HILOGW(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_WARN, 0xD001E00, tag, fmt, ##__VA_ARGS__)
38     #define RESMGR_HILOGI(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_INFO, 0xD001E00, tag, fmt, ##__VA_ARGS__)
39     #define RESMGR_HILOGD(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_DEBUG, 0xD001E00, tag, fmt, ##__VA_ARGS__)
40     #define RESMGR_HILOGF(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_FATAL, 0xD001E00, tag, fmt, ##__VA_ARGS__)
41 }
42 
43 namespace OHOS {
44 namespace Global {
45 namespace Resource {
46 extern LogLevel g_logLevel;
47 } // namespace Resource
48 } // namespace Global
49 } // namespace OHOS
50 
51 #else
52 
53 #define RESMGR_HILOGE(tag, fmt, ...)
54 #define RESMGR_HILOGW(tag, fmt, ...)
55 #define RESMGR_HILOGI(tag, fmt, ...)
56 #define RESMGR_HILOGD(tag, fmt, ...)
57 #define RESMGR_HILOGF(tag, fmt, ...)
58 
59 #endif  // CONFIG_HILOG
60 
61 #endif  // HILOG_WRAPPER_H