1bc2ed2b3Sopenharmony_ci/* 2bc2ed2b3Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3bc2ed2b3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc2ed2b3Sopenharmony_ci * you may not use this file except in compliance with the License. 5bc2ed2b3Sopenharmony_ci * You may obtain a copy of the License at 6bc2ed2b3Sopenharmony_ci * 7bc2ed2b3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc2ed2b3Sopenharmony_ci * 9bc2ed2b3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc2ed2b3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc2ed2b3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc2ed2b3Sopenharmony_ci * See the License for the specific language governing permissions and 13bc2ed2b3Sopenharmony_ci * limitations under the License. 14bc2ed2b3Sopenharmony_ci */ 15bc2ed2b3Sopenharmony_ci#ifndef LOG_HELPER_H 16bc2ed2b3Sopenharmony_ci#define LOG_HELPER_H 17bc2ed2b3Sopenharmony_ci 18bc2ed2b3Sopenharmony_ci#ifdef DEBUG 19bc2ed2b3Sopenharmony_ci#include "hilog/log.h" 20bc2ed2b3Sopenharmony_ci 21bc2ed2b3Sopenharmony_ci#ifdef FatalLog 22bc2ed2b3Sopenharmony_ci#undef FatalLog 23bc2ed2b3Sopenharmony_ci#endif 24bc2ed2b3Sopenharmony_ci 25bc2ed2b3Sopenharmony_ci#ifdef ErrorLog 26bc2ed2b3Sopenharmony_ci#undef ErrorLog 27bc2ed2b3Sopenharmony_ci#endif 28bc2ed2b3Sopenharmony_ci 29bc2ed2b3Sopenharmony_ci#ifdef WarnLog 30bc2ed2b3Sopenharmony_ci#undef WarnLog 31bc2ed2b3Sopenharmony_ci#endif 32bc2ed2b3Sopenharmony_ci 33bc2ed2b3Sopenharmony_ci#ifdef InfoLog 34bc2ed2b3Sopenharmony_ci#undef InfoLog 35bc2ed2b3Sopenharmony_ci#endif 36bc2ed2b3Sopenharmony_ci 37bc2ed2b3Sopenharmony_ci#ifdef DebugLog 38bc2ed2b3Sopenharmony_ci#undef DebugLog 39bc2ed2b3Sopenharmony_ci#endif 40bc2ed2b3Sopenharmony_ci 41bc2ed2b3Sopenharmony_ci#ifdef LOG_DOMAIN 42bc2ed2b3Sopenharmony_ci#undef LOG_DOMAIN 43bc2ed2b3Sopenharmony_ci#endif 44bc2ed2b3Sopenharmony_ci#define LOG_DOMAIN 0xD000301 45bc2ed2b3Sopenharmony_ci 46bc2ed2b3Sopenharmony_ci#ifdef LOG_TAG 47bc2ed2b3Sopenharmony_ci#undef LOG_TAG 48bc2ed2b3Sopenharmony_ci#endif 49bc2ed2b3Sopenharmony_ci#define LOG_TAG "Nfc_Core" 50bc2ed2b3Sopenharmony_ci 51bc2ed2b3Sopenharmony_ci#define FatalLog(fmt, ...) HILOG_FATAL( \ 52bc2ed2b3Sopenharmony_ci LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 53bc2ed2b3Sopenharmony_ci#define ErrorLog(fmt, ...) HILOG_ERROR( \ 54bc2ed2b3Sopenharmony_ci LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 55bc2ed2b3Sopenharmony_ci#define WarnLog(fmt, ...) HILOG_WARN( \ 56bc2ed2b3Sopenharmony_ci LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 57bc2ed2b3Sopenharmony_ci#define InfoLog(fmt, ...) HILOG_INFO( \ 58bc2ed2b3Sopenharmony_ci LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 59bc2ed2b3Sopenharmony_ci#define DebugLog(fmt, ...) HILOG_DEBUG( \ 60bc2ed2b3Sopenharmony_ci LOG_CORE, "[(%{public}s:%{public}d)]" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 61bc2ed2b3Sopenharmony_ci#else 62bc2ed2b3Sopenharmony_ci 63bc2ed2b3Sopenharmony_ci#define FatalLog(...) 64bc2ed2b3Sopenharmony_ci#define ErrorLog(...) 65bc2ed2b3Sopenharmony_ci#define WarnLog(...) 66bc2ed2b3Sopenharmony_ci#define InfoLog(...) 67bc2ed2b3Sopenharmony_ci#define DebugLog(...) 68bc2ed2b3Sopenharmony_ci#endif // DEBUG 69bc2ed2b3Sopenharmony_ci 70bc2ed2b3Sopenharmony_ci#endif // LOG_HELPER_H 71