Skip to content

Commit

Permalink
Combine config default headers
Browse files Browse the repository at this point in the history
The loggging defaults were split out since they are not namespaced to
coreMQTT, and they previously leaked to all files including a coreMQTT
header. Splitting them allowed the logging defaults to only be pulled
into coreMQTT source files. Now that no header files use the config
headers, and thus all coreMQTT config only affects coreMQTT source
files, the split is no longer needed.
  • Loading branch information
archigup committed Feb 1, 2024
1 parent 94f7185 commit a56cc28
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 138 deletions.
2 changes: 0 additions & 2 deletions source/core_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

#ifndef MQTT_PRE_SEND_HOOK

/**
Expand Down
2 changes: 0 additions & 2 deletions source/core_mqtt_serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

/**
* @brief MQTT protocol version 3.1.1.
*/
Expand Down
2 changes: 0 additions & 2 deletions source/core_mqtt_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

/*-----------------------------------------------------------*/

/**
Expand Down
80 changes: 80 additions & 0 deletions source/include/core_mqtt_config_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,86 @@
#error MQTT_SEND_RETRY_TIMEOUT_MS is deprecated. Instead use MQTT_SEND_TIMEOUT_MS.
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Error" level
* messages.
*
* To enable error level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports error logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C).
*
* <b>Default value</b>: Error logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogError
#define LogError( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Warning" level
* messages.
*
* To enable warning level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports warning logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Warning logs are turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogWarn
#define LogWarn( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Info" level
* messages.
*
* To enable info level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports info logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Info logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogInfo
#define LogInfo( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Debug" level
* messages.
*
* To enable debug level logging from MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports debug logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Debug logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogDebug
#define LogDebug( message )
#endif

/* *INDENT-OFF* */
#ifdef __cplusplus
}
Expand Down
132 changes: 0 additions & 132 deletions source/include/core_mqtt_default_logging.h

This file was deleted.

0 comments on commit a56cc28

Please sign in to comment.