146debc2cSopenharmony_ci/* 246debc2cSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 346debc2cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 446debc2cSopenharmony_ci * you may not use this file except in compliance with the License. 546debc2cSopenharmony_ci * You may obtain a copy of the License at 646debc2cSopenharmony_ci * 746debc2cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 846debc2cSopenharmony_ci * 946debc2cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1046debc2cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1146debc2cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1246debc2cSopenharmony_ci * See the License for the specific language governing permissions and 1346debc2cSopenharmony_ci * limitations under the License. 1446debc2cSopenharmony_ci */ 1546debc2cSopenharmony_ci 1646debc2cSopenharmony_ci#ifndef PRINT_LOG 1746debc2cSopenharmony_ci#define PRINT_LOG 1846debc2cSopenharmony_ci 1946debc2cSopenharmony_ci#define CONFIG_PRINT_LOG 2046debc2cSopenharmony_ci#ifdef CONFIG_PRINT_LOG 2146debc2cSopenharmony_ci#include "hilog/log.h" 2246debc2cSopenharmony_ci 2346debc2cSopenharmony_ci#ifdef PRINT_HILOGF 2446debc2cSopenharmony_ci#undef PRINT_HILOGF 2546debc2cSopenharmony_ci#endif 2646debc2cSopenharmony_ci 2746debc2cSopenharmony_ci#ifdef PRINT_HILOGE 2846debc2cSopenharmony_ci#undef PRINT_HILOGE 2946debc2cSopenharmony_ci#endif 3046debc2cSopenharmony_ci 3146debc2cSopenharmony_ci#ifdef PRINT_HILOGW 3246debc2cSopenharmony_ci#undef PRINT_HILOGW 3346debc2cSopenharmony_ci#endif 3446debc2cSopenharmony_ci 3546debc2cSopenharmony_ci#ifdef PRINT_HILOGD 3646debc2cSopenharmony_ci#undef PRINT_HILOGD 3746debc2cSopenharmony_ci#endif 3846debc2cSopenharmony_ci 3946debc2cSopenharmony_ci#ifdef PRINT_HILOGI 4046debc2cSopenharmony_ci#undef PRINT_HILOGI 4146debc2cSopenharmony_ci#endif 4246debc2cSopenharmony_ci 4346debc2cSopenharmony_ci#define PRINT_LOG_TAG "printkit" 4446debc2cSopenharmony_ci#define PRINT_LOG_DOMAIN 0xD001C00 4546debc2cSopenharmony_ci 4646debc2cSopenharmony_ci#ifdef IS_RELEASE_VERSION 4746debc2cSopenharmony_ci#define MAKE_FILE_NAME "" 4846debc2cSopenharmony_ci#else 4946debc2cSopenharmony_ci#define MAKE_FILE_NAME \ 5046debc2cSopenharmony_ci (__builtin_strrchr(__FILE_NAME__, '/') ? __builtin_strrchr(__FILE_NAME__, '/') + 1 : __FILE_NAME__) 5146debc2cSopenharmony_ci#endif 5246debc2cSopenharmony_ci 5346debc2cSopenharmony_ci#define PRINT_HILOGF(fmt, ...) \ 5446debc2cSopenharmony_ci (void)HILOG_IMPL(LOG_CORE, LOG_FATAL, PRINT_LOG_DOMAIN, PRINT_LOG_TAG, "[%{public}s %{public}s %{public}d] " fmt, \ 5546debc2cSopenharmony_ci MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 5646debc2cSopenharmony_ci 5746debc2cSopenharmony_ci#define PRINT_HILOGE(fmt, ...) \ 5846debc2cSopenharmony_ci (void)HILOG_IMPL(LOG_CORE, LOG_ERROR, PRINT_LOG_DOMAIN, PRINT_LOG_TAG, "[%{public}s %{public}s %{public}d] " fmt, \ 5946debc2cSopenharmony_ci MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 6046debc2cSopenharmony_ci 6146debc2cSopenharmony_ci#define PRINT_HILOGW(fmt, ...) \ 6246debc2cSopenharmony_ci (void)HILOG_IMPL(LOG_CORE, LOG_WARN, PRINT_LOG_DOMAIN, PRINT_LOG_TAG, "[%{public}s %{public}s %{public}d] " fmt, \ 6346debc2cSopenharmony_ci MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 6446debc2cSopenharmony_ci 6546debc2cSopenharmony_ci#define PRINT_HILOGD(fmt, ...) \ 6646debc2cSopenharmony_ci (void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, PRINT_LOG_DOMAIN, PRINT_LOG_TAG, "[%{public}s %{public}s %{public}d] " fmt, \ 6746debc2cSopenharmony_ci MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 6846debc2cSopenharmony_ci 6946debc2cSopenharmony_ci#define PRINT_HILOGI(fmt, ...) \ 7046debc2cSopenharmony_ci (void)HILOG_IMPL(LOG_CORE, LOG_INFO, PRINT_LOG_DOMAIN, PRINT_LOG_TAG, "[%{public}s %{public}s %{public}d] " fmt, \ 7146debc2cSopenharmony_ci MAKE_FILE_NAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) 7246debc2cSopenharmony_ci 7346debc2cSopenharmony_ci#else 7446debc2cSopenharmony_ci 7546debc2cSopenharmony_ci#define PRINT_HILOGF(fmt, ...) 7646debc2cSopenharmony_ci#define PRINT_HILOGE(fmt, ...) 7746debc2cSopenharmony_ci#define PRINT_HILOGW(fmt, ...) 7846debc2cSopenharmony_ci#define PRINT_HILOGD(fmt, ...) 7946debc2cSopenharmony_ci#define PRINT_HILOGI(fmt, ...) 8046debc2cSopenharmony_ci#endif // CONFIG_PRINT_LOG 8146debc2cSopenharmony_ci 8246debc2cSopenharmony_ci#endif /* PRINT_LOG */