1 /* 2 * Copyright (c) 2020 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 __LOG_H__ 17 #define __LOG_H__ 18 19 typedef void (*log_f)(const char *tag, const char *func_name, const char *format, ...); 20 21 struct log_f_group { 22 log_f log_d; 23 log_f log_i; 24 log_f log_w; 25 log_f log_e; 26 }; 27 28 log_f get_logd(void); 29 log_f get_logi(void); 30 log_f get_logw(void); 31 log_f get_loge(void); 32 33 #if !(defined(_CUT_LOG_)) 34 #define DBG_OUT(...) get_logd()("[HiChain]", __func__, __VA_ARGS__) 35 #define LOGI(...) get_logi()("[HiChain]", __func__, __VA_ARGS__) 36 #define LOGW(...) get_logw()("[HiChain]", __func__, __VA_ARGS__) 37 #define LOGE(...) get_loge()("[HiChain]", __func__, __VA_ARGS__) 38 #else 39 #define DBG_OUT(...) {} 40 #define LOGI(...) {} 41 #define LOGW(...) {} 42 #define LOGE(...) {} 43 #endif 44 45 #endif /* __LOG_H__ */ 46