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 DISTRIBUTEDDATA_LOG_PRINT_H
17 #define DISTRIBUTEDDATA_LOG_PRINT_H
18
19 #define OS_OHOS
20 #if defined OS_OHOS // log for OHOS
21
22 #include "hilog/log.h"
23 namespace OHOS {
24 namespace DistributedKv {
LogLabel()25 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
26 {
27 return { LOG_CORE, 0xD001610, "ZDDS" };
28 }
29 } // end namespace DistributesdKv
30
31 namespace DistributedData {
LogLabel()32 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
33 {
34 return { LOG_CORE, 0xD001611, "ZDD" };
35 }
36 } // end namespace DistributedData
37
38 namespace DistributedKVStore {
LogLabel()39 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
40 {
41 return { LOG_CORE, 0xD001612, "ZDD" };
42 }
43 } // end namespace DistributedKVStore
44
45 namespace AppDistributedKv {
LogLabel()46 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
47 {
48 return { LOG_CORE, 0xD001620, "ZDDC" };
49 }
50 } // namespace AppDistributedKv
51
52 namespace DistributedRdb {
LogLabel()53 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
54 {
55 return { LOG_CORE, 0xD001655, "DRDB" };
56 }
57 } // end namespace DistributedRdb
58
59 namespace DataShare {
LogLabel()60 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
61 {
62 return { LOG_CORE, 0xD001651, "DataShare" };
63 }
64 } // end namespace DataShare
65 } // end namespace OHOS
66
67 #define ZLOGD(fmt, ...) \
68 OHOS::HiviewDFX::HiLog::Debug(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
69
70 #define ZLOGI(fmt, ...) \
71 OHOS::HiviewDFX::HiLog::Info(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
72
73 #define ZLOGW(fmt, ...) \
74 OHOS::HiviewDFX::HiLog::Warn(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
75
76 #define ZLOGE(fmt, ...) \
77 OHOS::HiviewDFX::HiLog::Error(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
78
79 #else
80 #error // unknown system
81 #endif
82
83 #endif // DISTRIBUTEDDATA_LOG_PRINT_H
84