• 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 #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     #define RESMGR_HILOGW_BY_FLAG(flag, tag, fmt, ...)                              \
42         if (flag) {                                                                 \
43             HILOG_IMPL(LOG_CORE, LOG_WARN, 0xD001E00, tag, fmt, ##__VA_ARGS__);     \
44         }
45 }
46 
47 namespace OHOS {
48 namespace Global {
49 namespace Resource {
50 extern LogLevel g_logLevel;
51 } // namespace Resource
52 } // namespace Global
53 } // namespace OHOS
54 
55 #else
56 
57 #define RESMGR_HILOGE(tag, fmt, ...)
58 #define RESMGR_HILOGW(tag, fmt, ...)
59 #define RESMGR_HILOGI(tag, fmt, ...)
60 #define RESMGR_HILOGD(tag, fmt, ...)
61 #define RESMGR_HILOGF(tag, fmt, ...)
62 #define RESMGR_HILOGW_BY_FLAG(flag, tag, fmt, ...)
63 
64 #endif  // CONFIG_HILOG
65 
66 #endif  // HILOG_WRAPPER_H