AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
|
The library defines a logging system and uses it to print log messages. User application can also utilize it to pritn log messages. To use this logging system, the user application is required to provide default log level configuration while initializing the system.
The logging system works at a file level. To uniquely identify the files you have to define the module name for a file. While printing the log messages on the serial terminal the name of the module appears first followed by the log message. The APIs for printing log messages follow the printf
syntax.
Example API call:
Example output:
In order to print the log messages of various levels you need to call corresponing API. In the table below we have defined log levels along with its respective API for youre reference.
Log level | APIs |
---|---|
PRINT_LEVEL_ERROR | print_error |
PRINT_LEVEL_VERBOSE | print_verbose |
PRINT_LEVEL_INFO | print_info |
PRINT_LEVEL_DEBUG | print_debug |
Following log levels are defined.
Logging level | Description |
---|---|
PRINT_LEVEL_NONE | Does not print any log messages. |
PRINT_LEVEL_ERROR | Prints Error level log messages alone. |
PRINT_LEVEL_VERBOSE | Prints log messages of both Error & Verbose level. |
PRINT_LEVEL_INFO | Prints log messages of Error, Verbose & Info level. |
PRINT_LEVEL_DEBUG | Prints log messages of all levels. |
Refer the app_config.h
file from examples, you should see that the default log levels has been defined. Below is a sample of DEFAULT_LOG_LEVELS
taken from awsPubSub
example.
Below is the sample code that initliazes the system configuration with default log levels.
Sample application: