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 AIE_LOG_H
17#define AIE_LOG_H
18
19#include "log.h"
20
21#ifdef __cplusplus
22#if __cplusplus
23extern "C" {
24#endif
25#endif
26
27#define AI_LABEL "[AI]"
28#define NEW_LINE "\n"
29
30#if HILOG_COMPILE_LEVEL <= HILOG_LV_DEBUG
31#define HILOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, AI_LABEL "[%s:%d]" fmt NEW_LINE, \
32    __func__, __LINE__, ##__VA_ARGS__)
33#else
34#define HILOGD(fmt, ...)
35#endif
36
37#if HILOG_COMPILE_LEVEL <= HILOG_LV_INFO
38#define HILOGI(fmt, ...) HILOG_INFO(LOG_CORE, AI_LABEL "[%s:%d]" fmt NEW_LINE, \
39    __func__, __LINE__, ##__VA_ARGS__)
40#else
41#define HILOGI(fmt, ...)
42#endif
43
44#if HILOG_COMPILE_LEVEL <= HILOG_LV_WARN
45#define HILOGW(fmt, ...) HILOG_WARN(LOG_CORE, AI_LABEL "[%s:%d]" fmt NEW_LINE, \
46    __func__, __LINE__, ##__VA_ARGS__)
47#else
48#define HILOGW(fmt, ...)
49#endif
50
51#if HILOG_COMPILE_LEVEL <= HILOG_LV_ERROR
52#define HILOGE(fmt, ...) HILOG_ERROR(LOG_CORE, AI_LABEL "[%s:%d]" fmt NEW_LINE, \
53    __func__, __LINE__, ##__VA_ARGS__)
54#else
55#define HILOGE(fmt, ...)
56#endif
57
58#if HILOG_COMPILE_LEVEL <= HILOG_LV_FATAL
59#define HILOGF(fmt, ...) HILOG_FATAL(LOG_CORE, AI_LABEL "[%s:%d]" fmt NEW_LINE, \
60    __func__, __LINE__, ##__VA_ARGS__)
61#else
62#define HILOGF(fmt, ...)
63#endif
64
65#ifdef __cplusplus
66#if __cplusplus
67}
68#endif
69#endif
70
71#endif // AIE_LOG_H