14d6c458bSopenharmony_ci/*
24d6c458bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
34d6c458bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44d6c458bSopenharmony_ci * you may not use this file except in compliance with the License.
54d6c458bSopenharmony_ci * You may obtain a copy of the License at
64d6c458bSopenharmony_ci *
74d6c458bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84d6c458bSopenharmony_ci *
94d6c458bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104d6c458bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114d6c458bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124d6c458bSopenharmony_ci * See the License for the specific language governing permissions and
134d6c458bSopenharmony_ci * limitations under the License.
144d6c458bSopenharmony_ci */
154d6c458bSopenharmony_ci
164d6c458bSopenharmony_ci#ifndef COMMONLIBRARY_ETS_UTILS_TOOLS_LOG_H
174d6c458bSopenharmony_ci#define COMMONLIBRARY_ETS_UTILS_TOOLS_LOG_H
184d6c458bSopenharmony_ci
194d6c458bSopenharmony_ci#ifdef LINUX_PLATFORM
204d6c458bSopenharmony_ci#include <cstdint>
214d6c458bSopenharmony_ci#endif /* LINUX_PLATFORM */
224d6c458bSopenharmony_ci#include <cstring>
234d6c458bSopenharmony_ci#include <string>
244d6c458bSopenharmony_ci
254d6c458bSopenharmony_ci#include "utils/macros.h"
264d6c458bSopenharmony_ci
274d6c458bSopenharmony_ci#include "hilog/log.h"
284d6c458bSopenharmony_ci
294d6c458bSopenharmony_ci#undef LOG_DOMAIN
304d6c458bSopenharmony_ci#undef LOG_TAG
314d6c458bSopenharmony_ci#undef HILOG_FATAL
324d6c458bSopenharmony_ci#undef HILOG_ERROR
334d6c458bSopenharmony_ci#undef HILOG_WARN
344d6c458bSopenharmony_ci#undef HILOG_INFO
354d6c458bSopenharmony_ci#undef HILOG_DEBUG
364d6c458bSopenharmony_ci
374d6c458bSopenharmony_ci#define LOG_DOMAIN 0xD003F01
384d6c458bSopenharmony_ci#define LOG_TAG "NAPI"
394d6c458bSopenharmony_ci
404d6c458bSopenharmony_ci#define HILOG_FATAL(fmt, ...) \
414d6c458bSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, LOG_DOMAIN, LOG_TAG, \
424d6c458bSopenharmony_ci    "[(%{public}s:%{public}d)(%{public}s)] " fmt, "", __LINE__, __FUNCTION__, ##__VA_ARGS__))
434d6c458bSopenharmony_ci#define HILOG_ERROR(fmt, ...) \
444d6c458bSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, LOG_DOMAIN, LOG_TAG, \
454d6c458bSopenharmony_ci    "[(%{public}s:%{public}d)(%{public}s)] " fmt, "", __LINE__, __FUNCTION__, ##__VA_ARGS__))
464d6c458bSopenharmony_ci#define HILOG_WARN(fmt, ...) \
474d6c458bSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, LOG_DOMAIN, LOG_TAG, \
484d6c458bSopenharmony_ci    "[(%{public}s:%{public}d)(%{public}s)] " fmt, "", __LINE__, __FUNCTION__, ##__VA_ARGS__))
494d6c458bSopenharmony_ci#define HILOG_INFO(fmt, ...) \
504d6c458bSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, LOG_DOMAIN, LOG_TAG, \
514d6c458bSopenharmony_ci    "[(%{public}s:%{public}d)(%{public}s)] " fmt, "", __LINE__, __FUNCTION__, ##__VA_ARGS__))
524d6c458bSopenharmony_ci#define HILOG_DEBUG(fmt, ...) \
534d6c458bSopenharmony_ci    ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \
544d6c458bSopenharmony_ci    "[(%{public}s:%{public}d)(%{public}s)] " fmt, "", __LINE__, __FUNCTION__, ##__VA_ARGS__))
554d6c458bSopenharmony_ci
564d6c458bSopenharmony_ci#endif /* COMMONLIBRARY_ETS_UTILS_TOOLS_LOG_H */
57