1 /* 2 * Copyright (C) 2021 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 NSTACKX_DFINDER_LOG_H 17 #define NSTACKX_DFINDER_LOG_H 18 19 #include "nstackx.h" 20 #include "nstackx_log.h" 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #ifdef ENABLE_USER_LOG 26 uint32_t GetDFinderLogLevel(void); 27 void SetDFinderLogLevel(uint32_t logLevel); 28 #define DFINDER_LOG_COMMON NSTACKX_LOG_COMMON 29 30 #define DFINDER_LOGF(moduleName, format, ...) \ 31 DFINDER_LOG_COMMON(moduleName, DFINDER_LOG_LEVEL_FATAL, GetDFinderLogLevel(), format, ##__VA_ARGS__) 32 #define DFINDER_LOGE(moduleName, format, ...) \ 33 DFINDER_LOG_COMMON(moduleName, DFINDER_LOG_LEVEL_ERROR, GetDFinderLogLevel(), format, ##__VA_ARGS__) 34 #define DFINDER_LOGW(moduleName, format, ...) \ 35 DFINDER_LOG_COMMON(moduleName, DFINDER_LOG_LEVEL_WARNING, GetDFinderLogLevel(), format, ##__VA_ARGS__) 36 #define DFINDER_LOGI(moduleName, format, ...) \ 37 DFINDER_LOG_COMMON(moduleName, DFINDER_LOG_LEVEL_INFO, GetDFinderLogLevel(), format, ##__VA_ARGS__) 38 #define DFINDER_LOGD(moduleName, format, ...) \ 39 DFINDER_LOG_COMMON(moduleName, DFINDER_LOG_LEVEL_DEBUG, GetDFinderLogLevel(), format, ##__VA_ARGS__) 40 #else 41 42 #define DFINDER_LOGF LOGF 43 #define DFINDER_LOGE LOGE 44 #define DFINDER_LOGW LOGW 45 #define DFINDER_LOGI LOGI 46 #define DFINDER_LOGD LOGD 47 48 #endif 49 #ifdef __cplusplus 50 } 51 #endif 52 #endif /* #ifndef NSTACKX_DFINDER_LOG_H */ 53