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