• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #undef RESMGR_ANI_TAG
32 #define RESMGR_ANI_TAG "ResourceManagerAni"
33 
34 #ifdef CONFIG_HILOG
35 
36 #include "hilog/log.h"
37 
38 namespace OHOS::HiviewDFX {
39     #define RESMGR_HILOGE(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_ERROR, 0xD001E00, tag, fmt, ##__VA_ARGS__)
40     #define RESMGR_HILOGW(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_WARN, 0xD001E00, tag, fmt, ##__VA_ARGS__)
41     #define RESMGR_HILOGI(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_INFO, 0xD001E00, tag, fmt, ##__VA_ARGS__)
42     #define RESMGR_HILOGD(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_DEBUG, 0xD001E00, tag, fmt, ##__VA_ARGS__)
43     #define RESMGR_HILOGF(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_FATAL, 0xD001E00, tag, fmt, ##__VA_ARGS__)
44     #define RESMGR_HILOGI_BY_FLAG(flag, tag, fmt, ...)                              \
45         if (flag) {                                                                 \
46             HILOG_IMPL(LOG_CORE, LOG_INFO, 0xD001E00, tag, fmt, ##__VA_ARGS__);     \
47         }
48     #define RESMGR_HILOGW_BY_FLAG(flag, tag, fmt, ...)                              \
49         if (flag) {                                                                 \
50             HILOG_IMPL(LOG_CORE, LOG_WARN, 0xD001E00, tag, fmt, ##__VA_ARGS__);     \
51         }
52 }
53 
54 namespace OHOS {
55 namespace Global {
56 namespace Resource {
57 extern LogLevel g_logLevel;
58 } // namespace Resource
59 } // namespace Global
60 } // namespace OHOS
61 
62 #else
63 
64 #define RESMGR_HILOGE(tag, fmt, ...)
65 #define RESMGR_HILOGW(tag, fmt, ...)
66 #define RESMGR_HILOGI(tag, fmt, ...)
67 #define RESMGR_HILOGD(tag, fmt, ...)
68 #define RESMGR_HILOGF(tag, fmt, ...)
69 #define RESMGR_HILOGI_BY_FLAG(flag, tag, fmt, ...)
70 #define RESMGR_HILOGW_BY_FLAG(flag, tag, fmt, ...)
71 
72 #endif  // CONFIG_HILOG
73 
74 #endif  // HILOG_WRAPPER_H