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 #ifndef UTILS_BASE_LOG_H 16 #define UTILS_BASE_LOG_H 17 18 #ifdef CONFIG_HILOG 19 #include "hilog/log.h" 20 static constexpr OHOS::HiviewDFX::HiLogLabel label = { LOG_CORE, 0xD003D00, "utils_base" }; 21 #define UTILS_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(label, __VA_ARGS__) 22 #define UTILS_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(label, __VA_ARGS__) 23 #define UTILS_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(label, __VA_ARGS__) 24 #define UTILS_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(label, __VA_ARGS__) 25 #define UTILS_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(label, __VA_ARGS__) 26 #else 27 #define UTILS_LOGF(...) 28 #define UTILS_LOGE(...) 29 #define UTILS_LOGW(...) 30 #define UTILS_LOGI(...) 31 #define UTILS_LOGD(...) 32 #endif // CONFIG_HILOG 33 34 #if (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG) 35 static constexpr OHOS::HiviewDFX::HiLogLabel parcelLabel = { LOG_CORE, 0xD003D01, "parcel" }; 36 #define PARCEL_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(parcelLabel, __VA_ARGS__) 37 #define PARCEL_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(parcelLabel, __VA_ARGS__) 38 #define PARCEL_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(parcelLabel, __VA_ARGS__) 39 #define PARCEL_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(parcelLabel, __VA_ARGS__) 40 #define PARCEL_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(parcelLabel, __VA_ARGS__) 41 #else 42 #define PARCEL_LOGF(...) 43 #define PARCEL_LOGE(...) 44 #define PARCEL_LOGW(...) 45 #define PARCEL_LOGI(...) 46 #define PARCEL_LOGD(...) 47 #endif // (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG) 48 49 #endif // UTILS_BASE_LOG_H 50