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 24 namespace OHOS { 25 namespace Sensors { 26 namespace { 27 constexpr uint32_t MISC_LOG_DOMAIN = 0xD002701; 28 } // namespace 29 #ifndef MISC_FUNC_FMT 30 #define MISC_FUNC_FMT "in %{public}s " 31 #endif 32 33 #ifndef MISC_FUNC_INFO 34 #define MISC_FUNC_INFO __FUNCTION__ 35 #endif 36 37 #define MISC_HILOGD(fmt, ...) do { \ 38 OHOS::HiviewDFX::HiLog::Debug(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 39 } while (0) 40 #define MISC_HILOGI(fmt, ...) do { \ 41 OHOS::HiviewDFX::HiLog::Info(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 42 } while (0) 43 #define MISC_HILOGW(fmt, ...) do { \ 44 OHOS::HiviewDFX::HiLog::Warn(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 45 } while (0) 46 #define MISC_HILOGE(fmt, ...) do { \ 47 OHOS::HiviewDFX::HiLog::Error(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 48 } while (0) 49 #define MISC_LOGF(fmt, ...) do { \ 50 OHOS::HiviewDFX::HiLog::Fatal(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ 51 } while (0) 52 } // namespace Sensors 53 } // namespace OHOS 54 #endif // MISCDEVICE_LOG_H