1/*
2 * Copyright (C) 2021-2022 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#define CONFIG_HILOG
20#ifdef CONFIG_HILOG
21
22#include "hilog/log.h"
23
24#ifdef HILOG_FATAL
25#undef HILOG_FATAL
26#endif
27
28#ifdef HILOG_ERROR
29#undef HILOG_ERROR
30#endif
31
32#ifdef HILOG_WARN
33#undef HILOG_WARN
34#endif
35
36#ifdef HILOG_INFO
37#undef HILOG_INFO
38#endif
39
40#ifdef HILOG_DEBUG
41#undef HILOG_DEBUG
42#endif
43
44static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = {LOG_CORE, LOG_DOMAIN, CONTACTSDATA_LOG_TAG};
45
46#define HILOG_FATAL(...) (void)OHOS::HiviewDFX::HiLog::Fatal(LOG_LABEL, __VA_ARGS__)
47#define HILOG_ERROR(...) (void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, __VA_ARGS__)
48#define HILOG_WARN(...) (void)OHOS::HiviewDFX::HiLog::Warn(LOG_LABEL, __VA_ARGS__)
49#define HILOG_INFO(...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, __VA_ARGS__)
50#define HILOG_DEBUG(...) (void)OHOS::HiviewDFX::HiLog::Debug(LOG_LABEL, __VA_ARGS__)
51#else
52
53#define HILOG_FATAL(...)
54#define HILOG_ERROR(...)
55#define HILOG_WARN(...)
56#define HILOG_INFO(...)
57#define HILOG_DEBUG(...)
58
59#endif // CONFIG_HILOG
60
61#endif // HILOG_WRAPPER_H
62