1c29fa5a6Sopenharmony_ci/* 2c29fa5a6Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3c29fa5a6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c29fa5a6Sopenharmony_ci * you may not use this file except in compliance with the License. 5c29fa5a6Sopenharmony_ci * You may obtain a copy of the License at 6c29fa5a6Sopenharmony_ci * 7c29fa5a6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c29fa5a6Sopenharmony_ci * 9c29fa5a6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c29fa5a6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c29fa5a6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c29fa5a6Sopenharmony_ci * See the License for the specific language governing permissions and 13c29fa5a6Sopenharmony_ci * limitations under the License. 14c29fa5a6Sopenharmony_ci */ 15c29fa5a6Sopenharmony_ci 16c29fa5a6Sopenharmony_ci#ifndef KLOG_H 17c29fa5a6Sopenharmony_ci#define KLOG_H 18c29fa5a6Sopenharmony_ci 19c29fa5a6Sopenharmony_ci#include <cstring> 20c29fa5a6Sopenharmony_ci 21c29fa5a6Sopenharmony_cinamespace OHOS { 22c29fa5a6Sopenharmony_cinamespace MMI { 23c29fa5a6Sopenharmony_civoid kMsgLog(const char *fileName, int line, const char *kLevel, const char *fmt, ...); 24c29fa5a6Sopenharmony_ci 25c29fa5a6Sopenharmony_ci#ifndef MMI_FILE_NAME 26c29fa5a6Sopenharmony_ci#define MMI_FILE_NAME (strrchr((__FILE__), '/') ? strrchr((__FILE__), '/') + 1 : (__FILE__)) 27c29fa5a6Sopenharmony_ci#endif 28c29fa5a6Sopenharmony_ci#define KMSG_LOGT(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<7>", fmt"\n", ##__VA_ARGS__) 29c29fa5a6Sopenharmony_ci#define KMSG_LOGD(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<7>", fmt"\n", ##__VA_ARGS__) 30c29fa5a6Sopenharmony_ci#define KMSG_LOGI(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<6>", fmt"\n", ##__VA_ARGS__) 31c29fa5a6Sopenharmony_ci#define KMSG_LOGW(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<4>", fmt"\n", ##__VA_ARGS__) 32c29fa5a6Sopenharmony_ci#define KMSG_LOGE(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<3>", fmt"\n", ##__VA_ARGS__) 33c29fa5a6Sopenharmony_ci#define KMSG_LOGF(fmt, ...) kMsgLog((MMI_FILE_NAME), (__LINE__), "<3>", fmt"\n", ##__VA_ARGS__) 34c29fa5a6Sopenharmony_ci} // namespace MMI 35c29fa5a6Sopenharmony_ci} // namespace OHOS 36c29fa5a6Sopenharmony_ci#endif // KLOG_H 37