15bebb993Sopenharmony_ci/* 25bebb993Sopenharmony_ci * Copyright (c) 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 FILEMGMT_LIBHILOG_H 175bebb993Sopenharmony_ci#define FILEMGMT_LIBHILOG_H 185bebb993Sopenharmony_ci 195bebb993Sopenharmony_ci#include "hilog/log.h" 205bebb993Sopenharmony_ci 215bebb993Sopenharmony_ci#include <string> 225bebb993Sopenharmony_ci 235bebb993Sopenharmony_cinamespace OHOS { 245bebb993Sopenharmony_cinamespace FileManagement { 255bebb993Sopenharmony_ci 265bebb993Sopenharmony_ci#if defined __FILE_NAME__ 275bebb993Sopenharmony_ci#define FILEMGMT_FILE_NAME __FILE_NAME__ 285bebb993Sopenharmony_ci#else 295bebb993Sopenharmony_ci#define FILEMGMT_FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 305bebb993Sopenharmony_ci#endif 315bebb993Sopenharmony_ci 325bebb993Sopenharmony_ci#ifndef FILEMGMT_LOG_DOMAIN 335bebb993Sopenharmony_ci#define FILEMGMT_LOG_DOMAIN 0xD004388 345bebb993Sopenharmony_ci#endif 355bebb993Sopenharmony_ci 365bebb993Sopenharmony_ci#undef FILEMGMT_LOG_TAG 375bebb993Sopenharmony_ci#define FILEMGMT_LOG_TAG "file_api" 385bebb993Sopenharmony_ci 395bebb993Sopenharmony_ci 405bebb993Sopenharmony_ci#ifdef HILOGD 415bebb993Sopenharmony_ci#undef HILOGD 425bebb993Sopenharmony_ci#endif 435bebb993Sopenharmony_ci 445bebb993Sopenharmony_ci#ifdef HILOGF 455bebb993Sopenharmony_ci#undef HILOGF 465bebb993Sopenharmony_ci#endif 475bebb993Sopenharmony_ci 485bebb993Sopenharmony_ci#ifdef HILOGE 495bebb993Sopenharmony_ci#undef HILOGE 505bebb993Sopenharmony_ci#endif 515bebb993Sopenharmony_ci 525bebb993Sopenharmony_ci#ifdef HILOGW 535bebb993Sopenharmony_ci#undef HILOGW 545bebb993Sopenharmony_ci#endif 555bebb993Sopenharmony_ci 565bebb993Sopenharmony_ci#ifdef HILOGI 575bebb993Sopenharmony_ci#undef HILOGI 585bebb993Sopenharmony_ci#endif 595bebb993Sopenharmony_ci 605bebb993Sopenharmony_ci#define HILOGF(fmt, ...) \ 615bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, FILEMGMT_LOG_DOMAIN, FILEMGMT_LOG_TAG, \ 625bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 635bebb993Sopenharmony_ci#define HILOGE(fmt, ...) \ 645bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, FILEMGMT_LOG_DOMAIN, FILEMGMT_LOG_TAG, \ 655bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 665bebb993Sopenharmony_ci#define HILOGW(fmt, ...) \ 675bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, FILEMGMT_LOG_DOMAIN, FILEMGMT_LOG_TAG, \ 685bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 695bebb993Sopenharmony_ci#define HILOGI(fmt, ...) \ 705bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, FILEMGMT_LOG_DOMAIN, FILEMGMT_LOG_TAG, \ 715bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 725bebb993Sopenharmony_ci#define HILOGD(fmt, ...) \ 735bebb993Sopenharmony_ci ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, FILEMGMT_LOG_DOMAIN, FILEMGMT_LOG_TAG, \ 745bebb993Sopenharmony_ci "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)) 755bebb993Sopenharmony_ci} // namespace FileManagement 765bebb993Sopenharmony_ci} // namespace OHOS 775bebb993Sopenharmony_ci 785bebb993Sopenharmony_ci#endif // FILEMGMT_LIBHILOG_H