1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 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 16 #ifndef __FFRT_LOG_API_H__ 17 #define __FFRT_LOG_API_H__ 18 19 #include "log_base.h" 20 21 #if (FFRT_LOG_LEVEL >= FFRT_LOG_DEBUG) 22 #define FFRT_LOGD(format, ...) FFRT_LOG(FFRT_LOG_DEBUG, format, ##__VA_ARGS__) 23 #else 24 #define FFRT_LOGD(format, ...) 25 #endif 26 27 #if (FFRT_LOG_LEVEL >= FFRT_LOG_INFO) 28 #define FFRT_LOGI(format, ...) FFRT_LOG(FFRT_LOG_INFO, format, ##__VA_ARGS__) 29 #else 30 #define FFRT_LOGI(format, ...) 31 #endif 32 33 #if (FFRT_LOG_LEVEL >= FFRT_LOG_WARN) 34 #define FFRT_LOGW(format, ...) FFRT_LOG(FFRT_LOG_WARN, format, ##__VA_ARGS__) 35 #else 36 #define FFRT_LOGW(format, ...) 37 #endif 38 39 #define FFRT_LOGE(format, ...) FFRT_LOG(FFRT_LOG_ERROR, format, ##__VA_ARGS__) 40 41 #define FFRT_COND_DO_ERR(cond, expr, format, ...) \ 42 if (cond) { \ 43 FFRT_LOGE(format, ##__VA_ARGS__); \ 44 { \ 45 expr; \ 46 } \ 47 } 48 49 #endif // __FFRT_LOG_API_H__ 50