1/*
2 * Copyright (C) 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#ifndef LOG_HELPER_H
16#define LOG_HELPER_H
17
18#ifdef DEBUG
19#include "hilog/log.h"
20
21#ifdef FatalLog
22#undef FatalLog
23#endif
24
25#ifdef ErrorLog
26#undef ErrorLog
27#endif
28
29#ifdef WarnLog
30#undef WarnLog
31#endif
32
33#ifdef InfoLog
34#undef InfoLog
35#endif
36
37#ifdef DebugLog
38#undef DebugLog
39#endif
40
41#ifdef LOG_DOMAIN
42#undef LOG_DOMAIN
43#endif
44#define LOG_DOMAIN 0xD000301
45
46#ifdef LOG_TAG
47#undef LOG_TAG
48#endif
49#define LOG_TAG "Nfc_Core"
50
51#define FatalLog(fmt, ...) HILOG_FATAL( \
52    LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
53#define ErrorLog(fmt, ...) HILOG_ERROR( \
54    LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
55#define WarnLog(fmt, ...) HILOG_WARN(  \
56    LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
57#define InfoLog(fmt, ...) HILOG_INFO(  \
58    LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
59#define DebugLog(fmt, ...) HILOG_DEBUG( \
60    LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
61#else
62
63#define FatalLog(...)
64#define ErrorLog(...)
65#define WarnLog(...)
66#define InfoLog(...)
67#define DebugLog(...)
68#endif  // DEBUG
69
70#endif // LOG_HELPER_H
71