1/* 2 * Copyright (c) 2021 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_base/log_base.h" 20constexpr LogType UTILS_LOG_TYPE = LOG_CORE; 21constexpr unsigned int UTILS_LOG_DOMAIN = 0xD003D00; 22constexpr const char *UTILS_LOG_TAG = "utils_base"; 23#define UTILS_LOGF(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_FATAL, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) 24#define UTILS_LOGE(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_ERROR, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) 25#define UTILS_LOGW(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_WARN, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) 26#define UTILS_LOGI(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_INFO, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) 27#ifdef DEBUG_UTILS 28#define UTILS_LOGD(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) 29#else 30#define UTILS_LOGD(...) 31#endif 32#else 33#define UTILS_LOGF(...) 34#define UTILS_LOGE(...) 35#define UTILS_LOGW(...) 36#define UTILS_LOGI(...) 37#define UTILS_LOGD(...) 38#endif // CONFIG_HILOG 39 40#if (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG) 41constexpr LogType PARCEL_LOG_TYPE = LOG_CORE; 42constexpr unsigned int PARCEL_LOG_DOMAIN = 0xD003D01; 43constexpr const char *PARCEL_LOG_TAG = "parcel"; 44#define PARCEL_LOGF(...) \ 45 (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_FATAL, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) 46#define PARCEL_LOGE(...) \ 47 (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_ERROR, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) 48#define PARCEL_LOGW(...) \ 49 (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_WARN, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) 50#define PARCEL_LOGI(...) \ 51 (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_INFO, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) 52#define PARCEL_LOGD(...) \ 53 (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_DEBUG, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) 54#else 55#define PARCEL_LOGF(...) 56#define PARCEL_LOGE(...) 57#define PARCEL_LOGW(...) 58#define PARCEL_LOGI(...) 59#define PARCEL_LOGD(...) 60#endif // (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG) 61 62#endif // UTILS_BASE_LOG_H 63