AWS IoT Device SDK C: Logging
Generate and print log messages
Return to main page ↑
IotLogConfig_t Struct Reference

Log message configuration struct. More...

#include <iot_logging.h>

Data Fields

bool hideLogLevel
 Don't print the log level string for this message.
 
bool hideLibraryName
 Don't print the library name for this message.
 
bool hideTimestring
 Don't print the timestring for this message.
 

Detailed Description

Log message configuration struct.

Parameter for: IotLog, IotLog_Generic

By default, log messages print the library name, log level, and a timestring. This struct can be passed to IotLog_Generic to disable one of the above components in the log message.

Example:

IotLog_Generic( IOT_LOG_DEBUG, "SAMPLE", IOT_LOG_DEBUG, NULL, "Hello world!" );

The code above prints the following message:

[DEBUG][SAMPLE][2018-01-01 12:00:00] Hello world!

The timestring can be disabled as follows:

IotLogConfig_t logConfig = { .hideLogLevel = false, .hideLibraryName = false, .hideTimestring = true};
IotLog_Generic( IOT_LOG_DEBUG, "SAMPLE", IOT_LOG_DEBUG, &logConfig, "Hello world!" );

The resulting log message will be:

[DEBUG][SAMPLE] Hello world!

The documentation for this struct was generated from the following file: