MCUXpresso SDK API Reference Manual
Rev 2.12.1
NXP Semiconductors
|
This chapter describes the configurations of the log component.
Macros | |
#define | LOG_ENABLE 0 |
Whether to enable the log feature in the specific module, 1 - enable, 0 - disable. More... | |
#define | LOG_ENABLE_COLOR 1 |
Whether enable log color global feature, 1 - enable, 0 - disable. More... | |
#define | LOG_ENABLE_TIMESTAMP 1 |
Whether enable timestamp global feature for log, 1 - enable, 0 - disable. More... | |
#define | LOG_ENABLE_FILE_WITH_PATH 0 |
Whether enable source file name with path information global feature, 1 - enable, 0 - disable. More... | |
#define | LOG_MAX_MEESSAGE_LENGTH 128 |
Set the max message length, the default value is 128. More... | |
#define | LOG_ENABLE_ASYNC_MODE 0 |
Whether enable asynchronous log mode feature, 1 - enable, 0 - disable. More... | |
#define LOG_ENABLE 0 |
The feature is used to configure the log feature for the specific module. There are three steps should be followed to use the log component in specfic module,
step 1, define the macro LOG_ENABLE, likes as,
step 2, include the log component header file, likes as,
step 3, define the log module by using macro LOG_MODULE_DEFINE, likes as,
For example, In source file 1,
In source file 2,
#define LOG_ENABLE_COLOR 1 |
The feature is used to configure the log color feature for all of log component.
The feature should be defined in project setting.
Below shows how to configure in your project if you want to disable the feature.
For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols".
For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".
For ARMGCC, open CmakeLists.txt and add the following lines,
"SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_COLOR=0")" for debug target.
"SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_COLOR=0")" for release target.
For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
Complier->Preprocessor".
#define LOG_ENABLE_TIMESTAMP 1 |
The feature is used to configure the log timestamp feature for all of log component.
The feature should be defined in project setting.
Below shows how to configure in your project if you want to disable the feature.
For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols".
For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".
For ARMGCC, open CmakeLists.txt and add the following lines,
"SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_TIMESTAMP=0")" for debug target.
"SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_TIMESTAMP=0")" for release target.
For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
Complier->Preprocessor".
#define LOG_ENABLE_FILE_WITH_PATH 0 |
The feature is used to configure the source file name with path information feature for all of log component.
The feature should be defined in project setting.
Below shows how to configure in your project if you want to enable the feature.
For IAR, right click project and select "Options", define it in "C/C++
Compiler->Preprocessor->Defined symbols".
For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".
For ARMGCC, open CmakeLists.txt and add the following lines,
"SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_FILE_WITH_PATH=1")" for debug target.
"SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_FILE_WITH_PATH=1")" for release target.
For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
Complier->Preprocessor".
#define LOG_MAX_MEESSAGE_LENGTH 128 |
The feature is used to set the max message length, the default value is 128.
The feature should be defined in project setting.
Below shows how to configure in your project if you want to enable the feature.
For IAR, right click project and select "Options", define it in "C/C++
Compiler->Preprocessor->Defined symbols".
For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".
For ARMGCC, open CmakeLists.txt and add the following lines,
"SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_MAX_MEESSAGE_LENGTH=128")" for debug target.
"SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_MAX_MEESSAGE_LENGTH=128")" for release target.
For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
Complier->Preprocessor".
#define LOG_ENABLE_ASYNC_MODE 0 |
The feature is used to enable asynchronous log mode feature.
The feature should be defined in project setting.
Below shows how to configure in your project if you want to enable the feature.
For IAR, right click project and select "Options", define it in "C/C++
Compiler->Preprocessor->Defined symbols".
For KEIL, click "Options for Target...", define it in "C/C++->Preprocessor Symbols->Define".
For ARMGCC, open CmakeLists.txt and add the following lines,
"SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_ASYNC_MODE=1")" for debug target.
"SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLOG_ENABLE_ASYNC_MODE=1")" for release target.
For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
Complier->Preprocessor".