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 AppDistributedKv {
LogLabel()39 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
40 {
41 return { LOG_CORE, 0xD001620, "ZDDC" };
42 }
43 } // namespace AppDistributedKv
44
45 namespace DistributedRdb {
LogLabel()46 static inline OHOS::HiviewDFX::HiLogLabel LogLabel()
47 {
48 return { LOG_CORE, 0xD001655, "DRDB" };
49 }
50 } // end namespace DistributedRdb
51 } // end namespace OHOS
52
53 #define ZLOGD(fmt, ...) \
54 OHOS::HiviewDFX::HiLog::Debug(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
55
56 #define ZLOGI(fmt, ...) \
57 OHOS::HiviewDFX::HiLog::Info(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
58
59 #define ZLOGW(fmt, ...) \
60 OHOS::HiviewDFX::HiLog::Warn(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
61
62 #define ZLOGE(fmt, ...) \
63 OHOS::HiviewDFX::HiLog::Error(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__)
64
65 #else
66 #error // unknown system
67 #endif
68
69 #endif // DISTRIBUTEDDATA_LOG_PRINT_H
70