Skip to content

Commit 21878bd

Browse files
aggarw13gkwickerRichardBarry
authored
Allow overriding default definitions of logging macros (FreeRTOS#384)
* Update logging_stack.h file to avoid use of __FUNCTION__ macro * Revert to use __FUNCTION__ instead of __FILE__ * Fix comment about metadata format * Fix incorrect mapping of SdkLog function * Fix typo causing LOG_METADATA_ARGS to be undefined * Fix another bug with SdkLog macro definition * Fix formatting * Move mapping of SdkLog to vLoggingPrintf from logging_stack to config files * Remove dependency of LIBRARY_LOG_NAME on LIBRARY_METADATA_* macros * Minor improvements Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com> Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com>
1 parent 596b466 commit 21878bd

File tree

25 files changed

+391
-107
lines changed

25 files changed

+391
-107
lines changed

FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/core_mqtt_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@
4747
#define LIBRARY_LOG_LEVEL LOG_ERROR
4848
#endif
4949

50+
/* Prototype for the function used to print to console on Windows simulator
51+
* of FreeRTOS.
52+
* The function prints to the console before the network is connected;
53+
* then a UDP port after the network has connected. */
54+
extern void vLoggingPrintf( const char * pcFormatString,
55+
... );
56+
57+
/* Map the SdkLog macro to the logging function to enable logging
58+
* on Windows simulator. */
59+
#define SdkLog( message ) vLoggingPrintf message
60+
5061
#include "logging_stack.h"
5162
/************ End of logging configuration ****************/
5263

FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/demo_config.h

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,24 @@
5151
#ifndef LIBRARY_LOG_LEVEL
5252
#define LIBRARY_LOG_LEVEL LOG_INFO
5353
#endif
54+
55+
/* Prototype for the function used to print to console on Windows simulator
56+
* of FreeRTOS.
57+
* The function prints to the console before the network is connected;
58+
* then a UDP port after the network has connected. */
59+
extern void vLoggingPrintf( const char * pcFormatString,
60+
... );
61+
62+
/* Map the SdkLog macro to the logging function to enable logging
63+
* on Windows simulator. */
64+
#define SdkLog( message ) vLoggingPrintf message
65+
5466
#include "logging_stack.h"
5567

5668
/************ End of logging configuration ****************/
5769

5870
#ifndef democonfigCLIENT_IDENTIFIER
71+
5972
/**
6073
* @brief The MQTT client identifier used in this example. Each client identifier
6174
* must be unique so edit as required to ensure no two clients connecting to the
@@ -114,27 +127,27 @@
114127
* #define democonfigROOT_CA_PEM "...insert here..."
115128
*/
116129

117-
#define democonfigROOT_CA_PEM \
118-
"-----BEGIN CERTIFICATE-----\n"\
119-
"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n"\
120-
"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n"\
121-
"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n"\
122-
"MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n"\
123-
"b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\n"\
124-
"ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n"\
125-
"9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\n"\
126-
"IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\n"\
127-
"VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n"\
128-
"93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\n"\
129-
"jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\n"\
130-
"AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA\n"\
131-
"A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\n"\
132-
"U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\n"\
133-
"N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\n"\
134-
"o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n"\
135-
"5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n"\
136-
"rqXRfboQnoZsG4q5WTP468SQvvG5\n"\
137-
"-----END CERTIFICATE-----"
130+
#define democonfigROOT_CA_PEM \
131+
"-----BEGIN CERTIFICATE-----\n" \
132+
"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n" \
133+
"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" \
134+
"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n" \
135+
"MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n" \
136+
"b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\n" \
137+
"ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n" \
138+
"9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\n" \
139+
"IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\n" \
140+
"VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n" \
141+
"93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\n" \
142+
"jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\n" \
143+
"AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA\n" \
144+
"A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\n" \
145+
"U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\n" \
146+
"N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\n" \
147+
"o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n" \
148+
"5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n" \
149+
"rqXRfboQnoZsG4q5WTP468SQvvG5\n" \
150+
"-----END CERTIFICATE-----"
138151

139152
/**
140153
* @brief Client certificate.

FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/shadow_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
#define LIBRARY_LOG_LEVEL LOG_INFO
4545
#endif
4646

47+
/* Prototype for the function used to print to console on Windows simulator
48+
* of FreeRTOS.
49+
* The function prints to the console before the network is connected;
50+
* then a UDP port after the network has connected. */
51+
extern void vLoggingPrintf( const char * pcFormatString,
52+
... );
53+
54+
/* Map the SdkLog macro to the logging function to enable logging
55+
* on Windows simulator. */
56+
#define SdkLog( message ) vLoggingPrintf message
57+
4758
#include "logging_stack.h"
4859

4960
/************ End of logging configuration ****************/

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/core_mqtt_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@
4747
#define LIBRARY_LOG_LEVEL LOG_ERROR
4848
#endif
4949

50+
/* Prototype for the function used to print to console on Windows simulator
51+
* of FreeRTOS.
52+
* The function prints to the console before the network is connected;
53+
* then a UDP port after the network has connected. */
54+
extern void vLoggingPrintf( const char * pcFormatString,
55+
... );
56+
57+
/* Map the SdkLog macro to the logging function to enable logging
58+
* on Windows simulator. */
59+
#define SdkLog( message ) vLoggingPrintf message
60+
5061
#include "logging_stack.h"
5162
/************ End of logging configuration ****************/
5263

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/demo_config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@
5151
#ifndef LIBRARY_LOG_LEVEL
5252
#define LIBRARY_LOG_LEVEL LOG_INFO
5353
#endif
54+
55+
/* Prototype for the function used to print to console on Windows simulator
56+
* of FreeRTOS.
57+
* The function prints to the console before the network is connected;
58+
* then a UDP port after the network has connected. */
59+
extern void vLoggingPrintf( const char * pcFormatString,
60+
... );
61+
62+
/* Map the SdkLog macro to the logging function to enable logging
63+
* on Windows simulator. */
64+
#define SdkLog( message ) vLoggingPrintf message
65+
5466
#include "logging_stack.h"
5567

5668
/************ End of logging configuration ****************/

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/core_mqtt_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
#define LIBRARY_LOG_LEVEL LOG_NONE
5050
#endif
5151

52+
/* Prototype for the function used to print to console on Windows simulator
53+
* of FreeRTOS.
54+
* The function prints to the console before the network is connected;
55+
* then a UDP port after the network has connected. */
56+
extern void vLoggingPrintf( const char * pcFormatString,
57+
... );
58+
59+
/* Map the SdkLog macro to the logging function to enable logging
60+
* on Windows simulator. */
61+
#define SdkLog( message ) vLoggingPrintf message
62+
5263
#include "logging_stack.h"
5364
/************ End of logging configuration ****************/
5465

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/demo_config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@
4949
#ifndef LIBRARY_LOG_LEVEL
5050
#define LIBRARY_LOG_LEVEL LOG_INFO
5151
#endif
52+
53+
/* Prototype for the function used to print to console on Windows simulator
54+
* of FreeRTOS.
55+
* The function prints to the console before the network is connected;
56+
* then a UDP port after the network has connected. */
57+
extern void vLoggingPrintf( const char * pcFormatString,
58+
... );
59+
60+
/* Map the SdkLog macro to the logging function to enable logging
61+
* on Windows simulator. */
62+
#define SdkLog( message ) vLoggingPrintf message
63+
5264
#include "logging_stack.h"
5365

5466
/************ End of logging configuration ****************/

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/core_mqtt_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
#define LIBRARY_LOG_LEVEL LOG_ERROR
5050
#endif
5151

52+
/* Prototype for the function used to print to console on Windows simulator
53+
* of FreeRTOS.
54+
* The function prints to the console before the network is connected;
55+
* then a UDP port after the network has connected. */
56+
extern void vLoggingPrintf( const char * pcFormatString,
57+
... );
58+
59+
/* Map the SdkLog macro to the logging function to enable logging
60+
* on Windows simulator. */
61+
#define SdkLog( message ) vLoggingPrintf message
62+
5263
#include "logging_stack.h"
5364
/************ End of logging configuration ****************/
5465

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/demo_config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848
#ifndef LIBRARY_LOG_LEVEL
4949
#define LIBRARY_LOG_LEVEL LOG_INFO
5050
#endif
51+
52+
/* Prototype for the function used to print to console on Windows simulator
53+
* of FreeRTOS.
54+
* The function prints to the console before the network is connected;
55+
* then a UDP port after the network has connected. */
56+
extern void vLoggingPrintf( const char * pcFormatString,
57+
... );
58+
59+
/* Map the SdkLog macro to the logging function to enable logging
60+
* on Windows simulator. */
61+
#define SdkLog( message ) vLoggingPrintf message
62+
5163
#include "logging_stack.h"
5264

5365
/************ End of logging configuration ****************/

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/core_mqtt_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@
4747
#define LIBRARY_LOG_LEVEL LOG_ERROR
4848
#endif
4949

50+
/* Prototype for the function used to print to console on Windows simulator
51+
* of FreeRTOS.
52+
* The function prints to the console before the network is connected;
53+
* then a UDP port after the network has connected. */
54+
extern void vLoggingPrintf( const char * pcFormatString,
55+
... );
56+
57+
/* Map the SdkLog macro to the logging function to enable logging
58+
* on Windows simulator. */
59+
#define SdkLog( message ) vLoggingPrintf message
60+
5061
#include "logging_stack.h"
5162
/************ End of logging configuration ****************/
5263

0 commit comments

Comments
 (0)