158ec469eSopenharmony_ci/*
258ec469eSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
358ec469eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
458ec469eSopenharmony_ci * you may not use this file except in compliance with the License.
558ec469eSopenharmony_ci * You may obtain a copy of the License at
658ec469eSopenharmony_ci *
758ec469eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
858ec469eSopenharmony_ci *
958ec469eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1058ec469eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1158ec469eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1258ec469eSopenharmony_ci * See the License for the specific language governing permissions and
1358ec469eSopenharmony_ci * limitations under the License.
1458ec469eSopenharmony_ci */
1558ec469eSopenharmony_ci#ifndef MISCDEVICE_LOG_H
1658ec469eSopenharmony_ci#define MISCDEVICE_LOG_H
1758ec469eSopenharmony_ci
1858ec469eSopenharmony_ci#include "hilog/log.h"
1958ec469eSopenharmony_ci
2058ec469eSopenharmony_ci#include "sensors_errors.h"
2158ec469eSopenharmony_ci#include "miscdevice_log.h"
2258ec469eSopenharmony_ci
2358ec469eSopenharmony_ci#undef LOG_DOMAIN
2458ec469eSopenharmony_ci#define LOG_DOMAIN 0xD002701
2558ec469eSopenharmony_ci
2658ec469eSopenharmony_cinamespace OHOS {
2758ec469eSopenharmony_cinamespace Sensors {
2858ec469eSopenharmony_ci#ifndef MISC_FUNC_FMT
2958ec469eSopenharmony_ci#define MISC_FUNC_FMT "in %{public}s "
3058ec469eSopenharmony_ci#endif
3158ec469eSopenharmony_ci
3258ec469eSopenharmony_ci#ifndef MISC_FUNC_INFO
3358ec469eSopenharmony_ci#define MISC_FUNC_INFO __FUNCTION__
3458ec469eSopenharmony_ci#endif
3558ec469eSopenharmony_ci
3658ec469eSopenharmony_ci#define MISC_HILOGD(fmt, ...) do { \
3758ec469eSopenharmony_ci    HILOG_DEBUG(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \
3858ec469eSopenharmony_ci} while (0)
3958ec469eSopenharmony_ci#define MISC_HILOGI(fmt, ...) do { \
4058ec469eSopenharmony_ci    HILOG_INFO(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \
4158ec469eSopenharmony_ci} while (0)
4258ec469eSopenharmony_ci#define MISC_HILOGW(fmt, ...) do { \
4358ec469eSopenharmony_ci    HILOG_WARN(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \
4458ec469eSopenharmony_ci} while (0)
4558ec469eSopenharmony_ci#define MISC_HILOGE(fmt, ...) do { \
4658ec469eSopenharmony_ci    HILOG_ERROR(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \
4758ec469eSopenharmony_ci} while (0)
4858ec469eSopenharmony_ci#define MISC_LOGF(fmt, ...) do { \
4958ec469eSopenharmony_ci    HILOG_FATAL(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \
5058ec469eSopenharmony_ci} while (0)
5158ec469eSopenharmony_ci} // namespace Sensors
5258ec469eSopenharmony_ci} // namespace OHOS
5358ec469eSopenharmony_ci#endif // MISCDEVICE_LOG_H