1100ae2f9Sopenharmony_ci/*
2100ae2f9Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3100ae2f9Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4100ae2f9Sopenharmony_ci * you may not use this file except in compliance with the License.
5100ae2f9Sopenharmony_ci * You may obtain a copy of the License at
6100ae2f9Sopenharmony_ci *
7100ae2f9Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8100ae2f9Sopenharmony_ci *
9100ae2f9Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10100ae2f9Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11100ae2f9Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12100ae2f9Sopenharmony_ci * See the License for the specific language governing permissions and
13100ae2f9Sopenharmony_ci * limitations under the License.
14100ae2f9Sopenharmony_ci */
15100ae2f9Sopenharmony_ci
16100ae2f9Sopenharmony_ci#ifndef EMITTER_LOG_H
17100ae2f9Sopenharmony_ci#define EMITTER_LOG_H
18100ae2f9Sopenharmony_ci
19100ae2f9Sopenharmony_ci#include "hilog/log.h"
20100ae2f9Sopenharmony_ci
21100ae2f9Sopenharmony_ci#ifdef LOG_DOMAIN
22100ae2f9Sopenharmony_ci#undef LOG_DOMAIN
23100ae2f9Sopenharmony_ci#endif
24100ae2f9Sopenharmony_ci#ifdef LOG_TAG
25100ae2f9Sopenharmony_ci#undef LOG_TAG
26100ae2f9Sopenharmony_ci#endif
27100ae2f9Sopenharmony_ci
28100ae2f9Sopenharmony_ci#define LOG_DOMAIN 0xD001201
29100ae2f9Sopenharmony_ci#define LOG_TAG "Emitter"
30100ae2f9Sopenharmony_ci
31100ae2f9Sopenharmony_ci#define LOGI(...)                                           \
32100ae2f9Sopenharmony_ciif (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, LOG_INFO)) {       \
33100ae2f9Sopenharmony_ci    HILOG_INFO(LOG_CORE, ##__VA_ARGS__);                    \
34100ae2f9Sopenharmony_ci}
35100ae2f9Sopenharmony_ci
36100ae2f9Sopenharmony_ci#define LOGD(...)                                           \
37100ae2f9Sopenharmony_ciif (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, LOG_DEBUG)) {       \
38100ae2f9Sopenharmony_ci    HILOG_DEBUG(LOG_CORE, ##__VA_ARGS__);                    \
39100ae2f9Sopenharmony_ci}
40100ae2f9Sopenharmony_ci
41100ae2f9Sopenharmony_ci#define LOGW(...)                                           \
42100ae2f9Sopenharmony_ciif (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, LOG_WARN)) {      \
43100ae2f9Sopenharmony_ci    HILOG_WARN(LOG_CORE, __VA_ARGS__);                     \
44100ae2f9Sopenharmony_ci}
45100ae2f9Sopenharmony_ci
46100ae2f9Sopenharmony_ci#define LOGE(...)                                           \
47100ae2f9Sopenharmony_ciif (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, LOG_ERROR)) {      \
48100ae2f9Sopenharmony_ci    HILOG_ERROR(LOG_CORE, __VA_ARGS__);                     \
49100ae2f9Sopenharmony_ci}
50100ae2f9Sopenharmony_ci
51100ae2f9Sopenharmony_ci#endif // EMITTER_LOG_H