Configuration Parameter |
Selectable Option/Value |
Description |
Log to |
Serial interface--SD card--SPIFFS |
Select where the messages/data should be logged to |
Enable circular file system |
Check--Uncheck |
Enable or disable circular file system. If it is enable the data will be logged in to a circular file system with the given max file size, max files and prefix file name |
File path |
|
Select the full file path to log the data |
Max file size(bytes) |
|
Maximum size of a file in bytes |
Max files |
3 to 10 |
Select the maximum number file to be circulated |
Prefix file name |
|
The prefix name for the file system. The file name will be prefix_name_file number |
Log timestamp |
Milliseconds since boot--System time |
Type of the time stamp whether it is in milliseconds or system time format |
Configuration Parameter |
Selectable Option/Value |
Description |
Log level |
Info--Warning--Error |
Select the log level |
Tag |
|
Log system consists with three sections. Time stamp, Log tag and Log message. (time stamp) log_tag : log_message e.g. |
Sample time |
|
Set the sample time |
Port Name |
Port Type |
Date Type |
Description |
Message |
Vector |
uint8 |
Log message |
Port Name |
Port Type |
Date Type |
Description |
Max files |
Scalar |
int32 |
Configure the maximum number of files for the circular file system |
Max file size |
Scalar |
int32 |
Maximum file size in bytes per file |
When to use this block?
These blocks can be used to configure the ESP Log library to send log messages to serial monitor, to SD card or SPIFFS. If it is set to write the log messages tp SD card or SPIFFS, it can be write to s single file or it can be used as a circular file system. These block can be used not only to write new log messages but also direct all the log messages from the libraries to the preferred interface (Serial interface, SD card or SPIFFS).
How does this block work?
This will initialize the log system according to the given configuration settings. The SD card setup block or SPIFFS setup block is required if it is set to SD card or SPIFFS
This will outputs the log message according to the selected interface
This block can only be used when log messages are sent to SD card or SPIFFS when the circular file system is enabled. This will change the maximum number of file and the maximum file size on the fly.
Demo file: esp32_log_demo1.slx
This demo shows how to use String_processing_block to generate a string and log the messages to the serial monitor.
The serial monitor(color messages will only on ESP32 serial monitor on CMD or on VS Code extension) shows information message, one warning message and one error message as below.
Demo file: esp32_log_demo2.slx
This demo shows how to use String_processing_block to generate a string and log the messages to the SD card. The log1.txt file will be created in /sdcard/log_wj2 folder path and all the log messages will be written to that file.
After the model is successfully downloaded in to ESP32, wait about 10 seconds and remove the sd card. Plug into the computer and goto the above the above folder location and check the log1.txt file.