From a26a769fb45cf2b91dfdb2c8b100f497808e55ea Mon Sep 17 00:00:00 2001 From: Archit Aggarwal Date: Tue, 4 Aug 2020 11:14:39 -0700 Subject: [PATCH] Fix logging call in MQTT, Make hygiene improvement in logging stack (#1095) * Fix issues with logging across files * Fix format specifier causing warning --- src/mqtt.c | 2 +- src/mqtt_lightweight.c | 2 +- utest/mqtt_config.h | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mqtt.c b/src/mqtt.c index f2578281..0bd629ca 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -1109,7 +1109,7 @@ static MQTTStatus_t sendPublish( MQTTContext_t * pContext, } else { - LogDebug( "PUBLISH payload was not sent. Payload length was zero." ); + LogDebug( ( "PUBLISH payload was not sent. Payload length was zero." ) ); } } diff --git a/src/mqtt_lightweight.c b/src/mqtt_lightweight.c index 7ea35e3e..6d372522 100644 --- a/src/mqtt_lightweight.c +++ b/src/mqtt_lightweight.c @@ -1164,7 +1164,7 @@ static MQTTStatus_t deserializePublish( const MQTTPacketInfo_t * pIncomingPacket pPublishInfo->pPayload = pPacketIdentifierHigh + sizeof( uint16_t ); } - LogDebug( ( "Payload length %hu.", pPublishInfo->payloadLength ) ); + LogDebug( ( "Payload length %lu.", pPublishInfo->payloadLength ) ); } return status; diff --git a/utest/mqtt_config.h b/utest/mqtt_config.h index c1eb585b..f4e28cef 100644 --- a/utest/mqtt_config.h +++ b/utest/mqtt_config.h @@ -15,8 +15,13 @@ #include "logging_levels.h" /* Configure name and log level for the MQTT library. */ -#define LIBRARY_LOG_NAME "MQTT" -#define LIBRARY_LOG_LEVEL LOG_NONE +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "MQTT" +#endif + +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_NONE +#endif #include "logging_stack.h"