1/* 2 * Copyright (c) 2021-2022 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#ifndef MISCDEVICE_LOG_H 16#define MISCDEVICE_LOG_H 17 18#include "hilog/log.h" 19 20#include "sensors_errors.h" 21#include "miscdevice_log.h" 22 23#undef LOG_DOMAIN 24#define LOG_DOMAIN 0xD002701 25 26namespace OHOS { 27namespace Sensors { 28#ifndef MISC_FUNC_FMT 29#define MISC_FUNC_FMT "in %{public}s " 30#endif 31 32#ifndef MISC_FUNC_INFO 33#define MISC_FUNC_INFO __FUNCTION__ 34#endif 35 36#define MISC_HILOGD(fmt, ...) do { \ 37 HILOG_DEBUG(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 38} while (0) 39#define MISC_HILOGI(fmt, ...) do { \ 40 HILOG_INFO(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 41} while (0) 42#define MISC_HILOGW(fmt, ...) do { \ 43 HILOG_WARN(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 44} while (0) 45#define MISC_HILOGE(fmt, ...) do { \ 46 HILOG_ERROR(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 47} while (0) 48#define MISC_LOGF(fmt, ...) do { \ 49 HILOG_FATAL(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 50} while (0) 51} // namespace Sensors 52} // namespace OHOS 53#endif // MISCDEVICE_LOG_H