1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 OHOS_SP_LOG_H 16 #define OHOS_SP_LOG_H 17 18 namespace OHOS { 19 namespace SmartPerf { 20 typedef enum { 21 SP_LOG_DEBUG, 22 SP_LOG_INFO, 23 SP_LOG_WARN, 24 SP_LOG_ERROR, 25 } SpLogLevel; 26 27 void SpLog(SpLogLevel logLevel, const char *fmt, ...); 28 29 #define LOGD(fmt, ...) \ 30 SpLog(SP_LOG_DEBUG, (std::string("[") + "SP_daemon" + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) 31 32 #define LOGI(fmt, ...) \ 33 SpLog(SP_LOG_INFO, (std::string("[") + "SP_daemon" + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) 34 35 #define LOGW(fmt, ...) \ 36 SpLog(SP_LOG_WARN, (std::string("[") + "SP_daemon" + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) 37 38 #define LOGE(fmt, ...) \ 39 SpLog(SP_LOG_ERROR, (std::string("[") + "SP_daemon" + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) 40 } // namespace SmartPerf 41 } // namespace OHOS 42 #endif // OHOS_SP_LOG_H