15bebb993Sopenharmony_ci/* 25bebb993Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 35bebb993Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 45bebb993Sopenharmony_ci * you may not use this file except in compliance with the License. 55bebb993Sopenharmony_ci * You may obtain a copy of the License at 65bebb993Sopenharmony_ci * 75bebb993Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 85bebb993Sopenharmony_ci * 95bebb993Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 105bebb993Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 115bebb993Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125bebb993Sopenharmony_ci * See the License for the specific language governing permissions and 135bebb993Sopenharmony_ci * limitations under the License. 145bebb993Sopenharmony_ci */ 155bebb993Sopenharmony_ci 165bebb993Sopenharmony_ci#ifndef INTERFACES_KITS_JS_SRC_COMMON_LOG_H 175bebb993Sopenharmony_ci#define INTERFACES_KITS_JS_SRC_COMMON_LOG_H 185bebb993Sopenharmony_ci 195bebb993Sopenharmony_ci#include <cstdio> 205bebb993Sopenharmony_ci#include <string> 215bebb993Sopenharmony_ci#include <vector> 225bebb993Sopenharmony_ci 235bebb993Sopenharmony_ci#ifndef FILE_SUBSYSTEM_DEBUG_LOCAL 245bebb993Sopenharmony_ci#include "hilog/log.h" 255bebb993Sopenharmony_ci#endif 265bebb993Sopenharmony_ci 275bebb993Sopenharmony_cinamespace OHOS { 285bebb993Sopenharmony_cinamespace DistributedFS { 295bebb993Sopenharmony_ci#ifndef FILE_SUBSYSTEM_DEBUG_LOCAL 305bebb993Sopenharmony_ci#define FILEIO_DOMAIN_ID 0xD004388 315bebb993Sopenharmony_cistatic constexpr OHOS::HiviewDFX::HiLogLabel FILEIO_LABEL = { LOG_CORE, FILEIO_DOMAIN_ID, "file_api" }; 325bebb993Sopenharmony_ci 335bebb993Sopenharmony_ci#ifdef HILOGD 345bebb993Sopenharmony_ci#undef HILOGD 355bebb993Sopenharmony_ci#endif 365bebb993Sopenharmony_ci 375bebb993Sopenharmony_ci#ifdef HILOGF 385bebb993Sopenharmony_ci#undef HILOGF 395bebb993Sopenharmony_ci#endif 405bebb993Sopenharmony_ci 415bebb993Sopenharmony_ci#ifdef HILOGE 425bebb993Sopenharmony_ci#undef HILOGE 435bebb993Sopenharmony_ci#endif 445bebb993Sopenharmony_ci 455bebb993Sopenharmony_ci#ifdef HILOGW 465bebb993Sopenharmony_ci#undef HILOGW 475bebb993Sopenharmony_ci#endif 485bebb993Sopenharmony_ci 495bebb993Sopenharmony_ci#ifdef HILOGI 505bebb993Sopenharmony_ci#undef HILOGI 515bebb993Sopenharmony_ci#endif 525bebb993Sopenharmony_ci 535bebb993Sopenharmony_ci#define HILOGD(fmt, ...) \ 545bebb993Sopenharmony_ci (void)OHOS::HiviewDFX::HiLog::Debug(OHOS::DistributedFS::FILEIO_LABEL, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 555bebb993Sopenharmony_ci#define HILOGI(fmt, ...) \ 565bebb993Sopenharmony_ci (void)OHOS::HiviewDFX::HiLog::Info(OHOS::DistributedFS::FILEIO_LABEL, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 575bebb993Sopenharmony_ci#define HILOGW(fmt, ...) \ 585bebb993Sopenharmony_ci (void)OHOS::HiviewDFX::HiLog::Warn(OHOS::DistributedFS::FILEIO_LABEL, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 595bebb993Sopenharmony_ci#define HILOGE(fmt, ...) \ 605bebb993Sopenharmony_ci (void)OHOS::HiviewDFX::HiLog::Error(OHOS::DistributedFS::FILEIO_LABEL, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 615bebb993Sopenharmony_ci#define HILOGF(fmt, ...) \ 625bebb993Sopenharmony_ci (void)OHOS::HiviewDFX::HiLog::Fatal(OHOS::DistributedFS::FILEIO_LABEL, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 635bebb993Sopenharmony_ci 645bebb993Sopenharmony_ci#else 655bebb993Sopenharmony_ci 665bebb993Sopenharmony_ci#define HILOGF(fmt, ...) \ 675bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, FILEIO_DOMAIN_ID, FILEMGMT_LOG_TAG, \ 685bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 695bebb993Sopenharmony_ci#define HILOGE(fmt, ...) \ 705bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, FILEIO_DOMAIN_ID, FILEMGMT_LOG_TAG, \ 715bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 725bebb993Sopenharmony_ci#define HILOGW(fmt, ...) \ 735bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, FILEIO_DOMAIN_ID, FILEMGMT_LOG_TAG, \ 745bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 755bebb993Sopenharmony_ci#define HILOGI(fmt, ...) \ 765bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, FILEIO_DOMAIN_ID, FILEMGMT_LOG_TAG, \ 775bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 785bebb993Sopenharmony_ci#define HILOGD(fmt, ...) \ 795bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, FILEIO_DOMAIN_ID, FILEMGMT_LOG_TAG, \ 805bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 815bebb993Sopenharmony_ci 825bebb993Sopenharmony_ci#endif 835bebb993Sopenharmony_ci} // namespace DistributedFS 845bebb993Sopenharmony_ci} // namespace OHOS 855bebb993Sopenharmony_ci#endif // INTERFACES_KITS_JS_SRC_COMMON_LOG_H