AWS IoT Device SDK C:
Logging
Generate and print log messages
|
Return to main page ↑ |
Defines the logging macro IotLog. More...
Go to the source code of this file.
Macros | |
#define | IotLog(messageLevel, pLogConfig, ...) |
Logging function for a specific library. In most cases, this is the logging function to call. More... | |
#define | IotLogError(...) IotLog( IOT_LOG_ERROR, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_ERROR. More... | |
#define | IotLogWarn(...) IotLog( IOT_LOG_WARN, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_WARN. More... | |
#define | IotLogInfo(...) IotLog( IOT_LOG_INFO, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_INFO. More... | |
#define | IotLogDebug(...) IotLog( IOT_LOG_DEBUG, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_DEBUG. More... | |
#define | IotLog_PrintBuffer(pHeader, pBuffer, bufferSize) |
Log the contents of buffer as bytes. Only available when LIBRARY_LOG_LEVEL is IOT_LOG_DEBUG. More... | |
Defines the logging macro IotLog.
#define IotLog | ( | messageLevel, | |
pLogConfig, | |||
... | |||
) |
Logging function for a specific library. In most cases, this is the logging function to call.
This function prints a single log message. It is available when LIBRARY_LOG_LEVEL is not IOT_LOG_NONE. Log messages automatically include the log level, library name, and time. An optional IotLogConfig_t may be passed to this function to hide information for a single log message.
The logging library must be set up before this function may be called. See Setup and use for more information.
This logging function also has the following abbreviated forms that can be used when an IotLogConfig_t isn't needed.
Name | Equivalent to |
---|---|
IotLogError | IotLog( IOT_LOG_ERROR, NULL, ... ) |
IotLogWarn | IotLog( IOT_LOG_WARN, NULL, ... ) |
IotLogInfo | IotLog( IOT_LOG_INFO, NULL, ... ) |
IotLogDebug | IotLog( IOT_LOG_DEBUG, NULL, ... ) |
[in] | messageLevel | Log level of this message. Must be one of the Log levels. |
[in] | pLogConfig | Pointer to an IotLogConfig_t. Optional; pass NULL to ignore. |
[in] | ... | Message and format specification. |
#define IotLogError | ( | ... | ) | IotLog( IOT_LOG_ERROR, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_ERROR.
Equivalent to:
#define IotLogWarn | ( | ... | ) | IotLog( IOT_LOG_WARN, NULL, __VA_ARGS__ ) |
#define IotLogInfo | ( | ... | ) | IotLog( IOT_LOG_INFO, NULL, __VA_ARGS__ ) |
#define IotLogDebug | ( | ... | ) | IotLog( IOT_LOG_DEBUG, NULL, __VA_ARGS__ ) |
Abbreviated logging macro for level IOT_LOG_DEBUG.
Equivalent to:
#define IotLog_PrintBuffer | ( | pHeader, | |
pBuffer, | |||
bufferSize | |||
) |
Log the contents of buffer as bytes. Only available when LIBRARY_LOG_LEVEL is IOT_LOG_DEBUG.
This function prints the bytes located at a given memory address. It is intended for debugging only, and is therefore only available when LIBRARY_LOG_LEVEL is IOT_LOG_DEBUG.
Log messages printed by this function always include the log level, library name, and time. In addition, this function may print an optional header pHeader
before it prints the contents of the buffer. This function does not have an IotLogConfig_t parameter.
The logging library must be set up before this function may be called. See Setup and use for more information.
[in] | pHeader | A message to log before the buffer. Optional; pass NULL to ignore. |
[in] | pBuffer | Pointer to start of buffer. |
[in] | bufferSize | Size of pBuffer . |
Example
The code above prints something like the following: