APP LOG Module Application Notes
1. APP LOG module basic function introduction
APP Log module is a tool module provided by GR5xx SDK to assist developers in development and debugging, it has the following practical features:
Support customized hardware output mode, SDK provides UART output and J-Link RTT output by default, and users can also realize customized output mode by registering their own hardware transmission interface.
Support the implementation of log storage and export, you can store the logs into Flash, and use GRToolbox Android App to export and analyze the stored logs through Bluetooth LE when needed.
Support log filtering based on TAG and Level, and set different output formats for different Level logs.
Supports different output formats for different levels of logs. Supports colorful log output based on CSI.
2. Notes on APP LOG Module Usage
For detailed usage notes of APP LOG module, please refer to “GR5xx APP Log Application Notes”.
The normal operation of
printf()also relies on app_log.c, and thetrans_functransfer function passed in when initializing the APP LOG module withapp_log_init()is also used forprintf()printing.In custom_config.h,
APP_LOG_ENABLEon or off does not affectprintf()output. However, note that in the project that comes with the SDK, the entire APP LOG module is not initialized whenAPP_LOG_ENABLEis0, resulting in noprintf()output.When
APP_LOG_STORE_ENABLEis set to 1, the LOG output byprintf()andAPP_LOG_xxx()will be stored in Flash, and at this time, due to the characteristic ofprintf(), all the LOGs output withprintf(), every byte will be treated as a record, i.e., every byte is timestamped, which takes up a lot of space. Therefore, if LOG storage is enabled, you need to avoid typing LOGs withprintf()as much as possible.The actual writing of the LOG store to Flash does not occur when the LOG is hit. When hitting LOG, it just puts the LOG to be written into the ring buffer, and the actual operations involving Flash happen in the
app_log_store_schedule()function, which is to avoid the time-consuming Flash operations affecting the timing-sensitive tasks. For more details, please refer to the “Log Scheduling Interface” section in GR5xx APP Log Application Note.