1 /** 2 * Copyright (c) 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 16 #ifndef NAPI_CALENDAR_LOG_H 17 #define NAPI_CALENDAR_LOG_H 18 19 #ifndef LOG_TAG 20 #define LOG_TAG 21 #endif 22 23 #include "hilog/log.h" 24 25 namespace OHOS::CalendarApi { 26 static const OHOS::HiviewDFX::HiLogLabel CALENDAR_LABEL = { LOG_APP, 0x050a, "CalendarApi" }; 27 28 #define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 29 30 #define LOG_DEBUG(fmt, ...) \ 31 (void)OHOS::HiviewDFX::HiLog::Debug(CALENDAR_LABEL, \ 32 "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__) 33 #define LOG_INFO(fmt, ...) \ 34 (void)OHOS::HiviewDFX::HiLog::Info(CALENDAR_LABEL, \ 35 "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__) 36 #define LOG_WARN(fmt, ...) \ 37 (void)OHOS::HiviewDFX::HiLog::Warn(CALENDAR_LABEL, \ 38 "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__) 39 #define LOG_ERROR(fmt, ...) \ 40 (void)OHOS::HiviewDFX::HiLog::Error(CALENDAR_LABEL, \ 41 "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__) 42 #define LOG_FATAL(fmt, ...) \ 43 (void)OHOS::HiviewDFX::HiLog::Fatal(CALENDAR_LABEL, \ 44 "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__) 45 } // namespace OHOS::CalendarApi 46 #endif 47 48