The following compiler-defines are available to configure the Message Logger: GOAL_LM_BUFFER_SIZE: size of the ring buffer for the logging messages in bytes (default: 5120 byte)
CM-variables
For the configuration of the Message Logger the following CM-variables are available:
CM-Module-ID
GOAL_ID_LM
CM-variable-ID
0
CM-variable name
LM_CM_VAR_READBUFFER
Description
Buffer for reading online logging from device
CM data type
GOAL_CM_GENERIC
Size
128 bytes
Default value
from NVS or 0
CM-Module-ID
GOAL_ID_LM
CM-variable-ID
1
CM-variable name
LM_CM_VAR_CNT
Description
Control word for online log access
CM data type
GOAL_CM_UINT16
Size
2 bytes
Default value
from NVS or 0
CM-Module-ID
GOAL_ID_LM
CM-variable-ID
2
CM-variable name
LM_CM_VAR_ EXLOG_READBUFFER
Description
Buffer for reading exception logging from device
CM data type
GOAL_CM_GENERIC
Size
128 bytes
Default value
from NVS or 0
CM-Module-ID
GOAL_ID_LM
CM-variable-ID
3
CM-variable name
LM_CM_VAR_ EXLOG_CNT
Description
Control word for exception log access
CM data type
GOAL_CM_UINT16
Size
2 bytes
Default value
from NVS or 0
Implementation guidelines
Write a log message without parameters to the ring buffer
The log message is generated by the device detection module with the CM-module-ID GOAL_ID_DD. The log message "Error while enabling UDP channel" is classified as GOAL_LOG_ERROR and assigned to log-ID 4 and text-ID 5. Because no parameter shall be transferred, the length of parameter 1 and parameter 2 is 0.
Write a log message with parameters to the ring buffer
The log message is generated by the device detection module with the CM-module-ID GOAL_ID_DD. The log message "Error while opening UDP server channel on port $1" is classified as GOAL_LOG_ERROR and assigned to log-ID 1 and text-ID 2. In error case the port number of the UDP channel shall be reported. The port number has the data type uint32_t. The length of parameter 1 is 4 bytes. The following function sequence is necessary:
write header of the log message:
goal_lmLog(GOAL_ID_DD, 1, 2, 4, 0, GOAL_LOG_ERROR, "Error while opening UDP server channel on port $1");
write the parameter value:
goal_lmLogParamUINT32((uint32_t) DD_UDP_PORT);
finish the entry of the log message in the ring buffer: