AWS IoT Device SDK C:
Logging
Generate and print log messages
|
Return to main page ↑ |
Generate and print log messages.
This library allows other libraries to generate and print log messages, which can aid in debugging. Log messages are printed by passing strings to one of the logging functions. The features of this library include:
Dependencies of the logging library.
Currently, the logging library has the following dependencies:
1
, the logging library depends on the platform static memory component to allocate buffers for log messages. When IOT_STATIC_MEMORY_ONLY is 0
, the logging library will default to using the standard library's malloc and free functions. The logging library's memory allocation functions may always be overridden. Note that the logging library will silently discard logs if it fails to allocate memory for the message.How to set up and use the logging library.
The file iot_logging_setup.h should be included to configure logging for a single source file. Before including iot_logging_setup.h, the constants LIBRARY_LOG_LEVEL and LIBRARY_LOG_NAME must be defined.
For example, to configure all the "SAMPLE" library to print all messages below the info log level:
The code above will print something like the following: