MCUXpresso SDK API Reference Manual  Rev 2.15.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Log configuration

Overview

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...
 

Macro Definition Documentation

#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,

* #define LOG_ENABLE 1
*
Note
LOG_ENABLE could be re-defined as a MODULE enabled flag such as,
* #define LOG_ENABLE module_LOG_ENABLED_FLAG
*

step 2, include the log component header file, likes as,

* #include "fsl_component_log.h"
*

step 3, define the log module by using macro LOG_MODULE_DEFINE, likes as,

* LOG_MODULE_DEFINE(<module name>, <module log level>);
*
Note
The code block should be placed at the end of the header file including of the source code.

For example, In source file 1,

* #define LOG_ENABLE MODULE1_CONFIG_LOG_ENABLE
* #include "fsl_component_log.h"
* LOG_MODULE_DEFINE(module1, kLOG_LevelTrace);
*

In source file 2,

* #define LOG_ENABLE MODULE2_CONFIG_LOG_ENABLE
* #include "fsl_component_log.h"
* LOG_MODULE_DEFINE(module2, kLOG_LevelDebug);
*
#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".