Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This GOAL core module provides functions to output data via an output channel like UART or Ethernet. The data can be divided into the following categories, named logging levels:
error messages
warning messages
information messages
debug messages
For each logging level this module provides an output function:
Table: Logging level output functions
Logging level | Output function |
---|---|
Error | goal_logErr() |
Warning | goal_logWarn() |
Information | goal_logInfo() |
Debug | goal_logDbg() |
The escape sequences \n and \r are filtered out from the before being send out through the channel.
The output channel is configured by the compiler-defines GOAL_CONFIG_LOGGING_TARET_RAW
and GOAL_CONFIG_LOGGING_TARGET_SYSLOG
.
GOAL provides generic format descriptors to output data to make printf-like format specifiers portable compared to the architecture and compilers. The GOAL format descriptors are initialized architecture-specific in …\goal\plat\arch\common\goal_arch_common.h. The following format descriptors are available: FMT_d32, FMT_i32, FMT_u32, FMT_x32, FMT_d64, FMT_i64, FMT_u64, FMT_x64, FMT_size_t, FMT_ptr
and FMT_ptrdiff
. FMT_ptr
represents a pointer address. FMT_ptrdiff
represents a difference of two pointer addresses.
Example: The actual position value of data type int32_t
shall be printed as information:
Code Block | ||
---|---|---|
| ||
goal_logInfo("actual position: "FMT_i32" inc", (int32_t) actPosVal); |
The logging functionality is available after the state GOAL_FSA_INIT_GOAL
.
It is recommended only to enable logging during development as it can have a serious impact on the runtime behavior.
GOAL files:
goal_log.[h,c]
example:
…\goal\appl\task_lock
Configuration
The following compiler-defines are available to configure the logging:
GOAL_CONFIG_LOGGING:
0: logging is switched off for the complete GOAL system (default)
1: logging is switched on and the logging can be used by other GOAL components
GOAL_CONFIG_LOGGING_TARGET_RAW:
0: no board-specific output channel is available (default)
1: the board-specific output channel is used, most UART
The board-specific function goal_targetMsgRaw() must be available.
GOAL_CONFIG_LOGGING_TARGET_SYSLOG:
0: no output via a Ethernet channel (default)
1: output via the Ethernet channel as broadcast Ethernet frame, e.g. to indicate the frame by Wireshark
Platform API
Table: goal_targetMsgRaw()
Prototype | void goal_targetMsgRaw(const char *str, unsigned int len) | |
Description | This indication function transmits a raw message. | |
Parameters | Str | raw message |
Len | length of the raw message in bytes | |
Return values | None | |
Category | Optional | |
Condition | compiler-define GOAL_CONFIG_LOGGING_TARGET_RAW must be set to 1 |
Table of Contents |
---|