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_DFILE_LOG_H 17 #define NSTACKX_DFILE_LOG_H 18 19 #include "nstackx_dfile.h" 20 #include "nstackx_log.h" 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 uint32_t GetDFileLogLevel(void); 26 void SetDFileLogLevel(uint32_t logLevel); 27 #define DFILE_LOG_COMMON NSTACKX_LOG_COMMON 28 29 #define DFILE_LOGF(moduleName, format, ...) \ 30 DFILE_LOG_COMMON(moduleName, DFILE_LOG_LEVEL_FATAL, GetDFileLogLevel(), format, ##__VA_ARGS__) 31 #define DFILE_LOGE(moduleName, format, ...) \ 32 DFILE_LOG_COMMON(moduleName, DFILE_LOG_LEVEL_ERROR, GetDFileLogLevel(), format, ##__VA_ARGS__) 33 #define DFILE_LOGW(moduleName, format, ...) \ 34 DFILE_LOG_COMMON(moduleName, DFILE_LOG_LEVEL_WARNING, GetDFileLogLevel(), format, ##__VA_ARGS__) 35 #define DFILE_LOGI(moduleName, format, ...) \ 36 DFILE_LOG_COMMON(moduleName, DFILE_LOG_LEVEL_INFO, GetDFileLogLevel(), format, ##__VA_ARGS__) 37 #define DFILE_LOGD(moduleName, format, ...) \ 38 DFILE_LOG_COMMON(moduleName, DFILE_LOG_LEVEL_DEBUG, GetDFileLogLevel(), format, ##__VA_ARGS__) 39 40 #ifdef __cplusplus 41 } 42 #endif 43 #endif /* #ifndef NSTACKX_DFILE_LOG_H */