1eace7efcSopenharmony_ci/*
2eace7efcSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3eace7efcSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4eace7efcSopenharmony_ci * you may not use this file except in compliance with the License.
5eace7efcSopenharmony_ci * You may obtain a copy of the License at
6eace7efcSopenharmony_ci *
7eace7efcSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8eace7efcSopenharmony_ci *
9eace7efcSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10eace7efcSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11eace7efcSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12eace7efcSopenharmony_ci * See the License for the specific language governing permissions and
13eace7efcSopenharmony_ci * limitations under the License.
14eace7efcSopenharmony_ci */
15eace7efcSopenharmony_ci
16eace7efcSopenharmony_ci#ifndef HILOG_WRAPPER_H
17eace7efcSopenharmony_ci#define HILOG_WRAPPER_H
18eace7efcSopenharmony_ci
19eace7efcSopenharmony_ci#define CONFIG_HILOG
20eace7efcSopenharmony_ci#ifdef CONFIG_HILOG
21eace7efcSopenharmony_ci#include "hilog/log.h"
22eace7efcSopenharmony_ci
23eace7efcSopenharmony_ci#ifdef HILOG_FATAL
24eace7efcSopenharmony_ci#undef HILOG_FATAL
25eace7efcSopenharmony_ci#endif
26eace7efcSopenharmony_ci
27eace7efcSopenharmony_ci#ifdef HILOG_ERROR
28eace7efcSopenharmony_ci#undef HILOG_ERROR
29eace7efcSopenharmony_ci#endif
30eace7efcSopenharmony_ci
31eace7efcSopenharmony_ci#ifdef HILOG_WARN
32eace7efcSopenharmony_ci#undef HILOG_WARN
33eace7efcSopenharmony_ci#endif
34eace7efcSopenharmony_ci
35eace7efcSopenharmony_ci#ifdef HILOG_INFO
36eace7efcSopenharmony_ci#undef HILOG_INFO
37eace7efcSopenharmony_ci#endif
38eace7efcSopenharmony_ci
39eace7efcSopenharmony_ci#ifdef HILOG_DEBUG
40eace7efcSopenharmony_ci#undef HILOG_DEBUG
41eace7efcSopenharmony_ci#endif
42eace7efcSopenharmony_ci
43eace7efcSopenharmony_ci#ifndef AMS_LOG_DOMAIN
44eace7efcSopenharmony_ci#define AMS_LOG_DOMAIN 0xD001304
45eace7efcSopenharmony_ci#endif
46eace7efcSopenharmony_ci
47eace7efcSopenharmony_ci#ifndef AMS_LOG_TAG
48eace7efcSopenharmony_ci#define AMS_LOG_TAG "AbilityManagerService"
49eace7efcSopenharmony_ci#endif
50eace7efcSopenharmony_ci
51eace7efcSopenharmony_ci#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
52eace7efcSopenharmony_ci
53eace7efcSopenharmony_ci#define HILOG_FATAL(fmt, ...)            \
54eace7efcSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, AMS_LOG_DOMAIN, AMS_LOG_TAG, \
55eace7efcSopenharmony_ci    "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
56eace7efcSopenharmony_ci#define HILOG_ERROR(fmt, ...)            \
57eace7efcSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, AMS_LOG_DOMAIN, AMS_LOG_TAG, \
58eace7efcSopenharmony_ci    "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
59eace7efcSopenharmony_ci#define HILOG_WARN(fmt, ...)            \
60eace7efcSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, AMS_LOG_DOMAIN, AMS_LOG_TAG, \
61eace7efcSopenharmony_ci    "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
62eace7efcSopenharmony_ci#define HILOG_INFO(fmt, ...)            \
63eace7efcSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, AMS_LOG_DOMAIN, AMS_LOG_TAG, \
64eace7efcSopenharmony_ci    "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
65eace7efcSopenharmony_ci#define HILOG_DEBUG(fmt, ...)            \
66eace7efcSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, AMS_LOG_DOMAIN, AMS_LOG_TAG, \
67eace7efcSopenharmony_ci    "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__))
68eace7efcSopenharmony_ci#else
69eace7efcSopenharmony_ci
70eace7efcSopenharmony_ci#define HILOG_FATAL(...)
71eace7efcSopenharmony_ci#define HILOG_ERROR(...)
72eace7efcSopenharmony_ci#define HILOG_WARN(...)
73eace7efcSopenharmony_ci#define HILOG_INFO(...)
74eace7efcSopenharmony_ci#define HILOG_DEBUG(...)
75eace7efcSopenharmony_ci#endif  // CONFIG_HILOG
76eace7efcSopenharmony_ci
77eace7efcSopenharmony_ci#endif  // HILOG_WRAPPER_H
78