1 /* 2 * Copyright 2020 NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 * 8 */ 9 10 #ifndef __FSL_COMPONENT_LOG_CONFIG_H__ 11 #define __FSL_COMPONENT_LOG_CONFIG_H__ 12 13 /*! 14 * @addtogroup fsl_component_log_config 15 * @ingroup fsl_component_log 16 * @{ 17 */ 18 19 /*! 20 * @brief Whether to enable the log feature in the specific module, 1 - enable, 0 - disable. 21 * @details The feature is used to configure the log feature for the specific module. 22 * There are three steps should be followed to use the log component in specfic module, 23 * 24 * step 1, define the macro LOG_ENABLE, likes as, 25 * @code 26 * #define LOG_ENABLE 1 27 * @endcode 28 * @note LOG_ENABLE could be re-defined as a MODULE enabled flag such as, 29 * @code 30 * #define LOG_ENABLE module_LOG_ENABLED_FLAG 31 * @endcode 32 * 33 * step 2, include the log component header file, likes as, 34 * @code 35 * #include "fsl_component_log.h" 36 * @endcode 37 * step 3, define the log module by using macro LOG_MODULE_DEFINE, likes as, 38 * @code 39 * LOG_MODULE_DEFINE(<module name>, <module log level>); 40 * @endcode 41 * 42 * @note The code block should be placed at the end of the header file including of the source code. 43 * 44 * For example, 45 * In source file 1, 46 * @code 47 * #define LOG_ENABLE MODULE1_CONFIG_LOG_ENABLE 48 * #include "fsl_component_log.h" 49 * LOG_MODULE_DEFINE(module1, kLOG_LevelTrace); 50 * @endcode 51 * In source file 2, 52 * @code 53 * #define LOG_ENABLE MODULE2_CONFIG_LOG_ENABLE 54 * #include "fsl_component_log.h" 55 * LOG_MODULE_DEFINE(module2, kLOG_LevelDebug); 56 * @endcode 57 */ 58 #ifndef LOG_ENABLE 59 #define LOG_ENABLE 0 60 #endif 61 62 /*! @brief Whether enable log color global feature, 1 - enable, 0 - disable. 63 * @details The feature is used to configure the log color feature for all of log component.@n 64 * The feature should be defined in project setting.@n 65 * Below shows how to configure in your project if you want to disable the feature.@n 66 * For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols".@n 67 * For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".@n 68 * For ARMGCC, open CmakeLists.txt and add the following lines,@n 69 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_COLOR=0")" for debug target.@n 70 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_COLOR=0")" for release target.@n 71 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 72 * Complier->Preprocessor".@n 73 */ 74 #ifndef LOG_ENABLE_COLOR 75 #define LOG_ENABLE_COLOR 1 76 #endif 77 78 /*! @brief Whether enable timestamp global feature for log, 1 - enable, 0 - disable. 79 * @details The feature is used to configure the log timestamp feature for all of log component.@n 80 * The feature should be defined in project setting.@n 81 * Below shows how to configure in your project if you want to disable the feature.@n 82 * For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols".@n 83 * For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".@n 84 * For ARMGCC, open CmakeLists.txt and add the following lines,@n 85 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_TIMESTAMP=0")" for debug target.@n 86 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_TIMESTAMP=0")" for release target.@n 87 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 88 * Complier->Preprocessor".@n 89 */ 90 #ifndef LOG_ENABLE_TIMESTAMP 91 #define LOG_ENABLE_TIMESTAMP 1 92 #endif 93 94 /*! @brief Whether enable source file name with path information global feature, 1 - enable, 0 - disable. 95 * @details The feature is used to configure the source file name with path information feature for all of log 96 * component.@n The feature should be defined in project setting.@n Below shows how to configure in your project if you 97 * want to enable the feature.@n For IAR, right click project and select "Options", define it in "C/C++ 98 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 99 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 100 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_FILE_WITH_PATH=1")" for debug target.@n 101 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_FILE_WITH_PATH=1")" for release target.@n 102 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 103 * Complier->Preprocessor".@n 104 */ 105 #ifndef LOG_ENABLE_FILE_WITH_PATH 106 #define LOG_ENABLE_FILE_WITH_PATH 0 107 #endif 108 109 /*! @brief Set the max message length, the default value is 128. 110 * @details The feature is used to set the max message length, the default value is 128.@n 111 * The feature should be defined in project setting.@n Below shows how to configure in your project if you 112 * want to enable the feature.@n For IAR, right click project and select "Options", define it in "C/C++ 113 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 114 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 115 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_MAX_MEESSAGE_LENGTH=128")" for debug target.@n 116 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_MAX_MEESSAGE_LENGTH=128")" for release target.@n 117 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 118 * Complier->Preprocessor".@n 119 */ 120 #ifndef LOG_MAX_MEESSAGE_LENGTH 121 #define LOG_MAX_MEESSAGE_LENGTH 128 122 #endif 123 124 /*! @brief Whether enable asynchronous log mode feature, 1 - enable, 0 - disable. 125 * @details The feature is used to enable asynchronous log mode feature.@n 126 * The feature should be defined in project setting.@n Below shows how to configure in your project if you 127 * want to enable the feature.@n For IAR, right click project and select "Options", define it in "C/C++ 128 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 129 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 130 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_ASYNC_MODE=1")" for debug target.@n 131 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_ASYNC_MODE=1")" for release target.@n 132 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 133 * Complier->Preprocessor".@n 134 */ 135 #ifndef LOG_ENABLE_ASYNC_MODE 136 #define LOG_ENABLE_ASYNC_MODE 0 137 #endif 138 139 #if (LOG_ENABLE_ASYNC_MODE > 0) 140 /*! @brief Set the max argument count, the default value is 4. 141 * @details The feature is used to set the max argument count.@n 142 * The feature should be defined in project setting.@n Below shows how to configure in your project if you 143 * want to change the default value.@n For IAR, right click project and select "Options", define it in "C/C++ 144 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 145 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 146 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_MAX_ARGUMENT_COUNT=4")" for debug target.@n 147 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_MAX_ARGUMENT_COUNT=4")" for release target.@n 148 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 149 * Complier->Preprocessor".@n 150 */ 151 #ifndef LOG_MAX_ARGUMENT_COUNT 152 #define LOG_MAX_ARGUMENT_COUNT 4 153 #endif 154 155 /*! @brief Set the max bufferred log count, the default value is 16. 156 * @details The feature is used to set the max bufferred log count.@n 157 * The feature should be defined in project setting.@n Below shows how to configure in your project if you 158 * want to change the default value.@n For IAR, right click project and select "Options", define it in "C/C++ 159 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 160 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 161 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_MAX_ARGUMENT_COUNT=4")" for debug target.@n 162 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_MAX_ARGUMENT_COUNT=4")" for release target.@n 163 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 164 * Complier->Preprocessor".@n 165 */ 166 #ifndef LOG_MAX_BUFF_LOG_COUNT 167 #define LOG_MAX_BUFF_LOG_COUNT 16 168 #endif 169 170 /*! @brief Whether enable overwrite log feature in asynchronous mode, 1 - enable, 0 - disable. 171 * @details The feature is used to enable overwrite log feature in asynchronous mode.@n 172 * The feature should be defined in project setting.@n Below shows how to configure in your project if you 173 * want to enable the feature.@n For IAR, right click project and select "Options", define it in "C/C++ 174 * Compiler->Preprocessor->Defined symbols".@n For KEIL, click "Options for Target...", define it in 175 * "C/C++->Preprocessor Symbols->Define".@n For ARMGCC, open CmakeLists.txt and add the following lines,@n 176 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_ASYNC_MODE=1")" for debug target.@n 177 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_ASYNC_MODE=1")" for release target.@n 178 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C 179 * Complier->Preprocessor".@n 180 */ 181 #ifndef LOG_ENABLE_OVERWRITE 182 #define LOG_ENABLE_OVERWRITE 1 183 #endif 184 #endif 185 186 /*! @} */ 187 188 #endif /* __FSL_COMPONENT_LOG_CONFIG_H__ */ 189