diff options
author | Oscar Michael Abrina <abrinao@amazon.com> | 2020-11-10 10:51:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 10:51:01 -0800 |
commit | 1876800382986f5f4d9d6c90f25cd087daaeec96 (patch) | |
tree | 7c7ffaf399d60c19c7332dfe36bafca7113cc9b1 | |
parent | 993937437986bd78484576360f8648fedf0bc4a7 (diff) | |
download | freertos-git-1876800382986f5f4d9d6c90f25cd087daaeec96.tar.gz |
Print metadata only after a line break (#397)
* Fix logging stack to print message in the first SdkLog
* Do not log metadata if on the same line
* Fix wrong var name
* Change task names to DemoTask
* Change for shadow too
* Move declaration to a separate line
Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
9 files changed, 22 insertions, 19 deletions
diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c index b3d36da0a..5547a4db2 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/ShadowDemoMainExample.c @@ -532,7 +532,7 @@ void vStartShadowDemo( void ) * use Device Shadow library to get shadow topics and validate shadow topics * via MQTT APIs communicating with the MQTT broker. */ xTaskCreate( prvShadowDemoTask, /* Function that implements the task. */ - "ShadowDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c b/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c index 20163e77a..e8a453f35 100644 --- a/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c +++ b/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c @@ -263,6 +263,7 @@ void vLoggingPrintf( const char * pcFormat, char * pcSource, * pcTarget, * pcBegin; size_t xLength, xLength2, rc; static BaseType_t xMessageNumber = 0; + static BaseType_t xAfterLineBreak = pdTRUE; va_list args; uint32_t ulIPAddress; const char * pcTaskName; @@ -286,17 +287,19 @@ void vLoggingPrintf( const char * pcFormat, pcTaskName = pcNoTask; } - if( strcmp( pcFormat, "\r\n" ) != 0 ) + if( ( xAfterLineBreak == pdTRUE ) && ( strcmp( pcFormat, "\r\n" ) != 0 ) ) { xLength = snprintf( cPrintString, dlMAX_PRINT_STRING_LENGTH, "%lu %lu [%s] ", xMessageNumber++, ( unsigned long ) xTaskGetTickCount(), pcTaskName ); + xAfterLineBreak = pdFALSE; } else { xLength = 0; memset( cPrintString, 0x00, dlMAX_PRINT_STRING_LENGTH ); + xAfterLineBreak = pdTRUE; } xLength2 = vsnprintf( cPrintString + xLength, dlMAX_PRINT_STRING_LENGTH - xLength, pcFormat, args ); diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/DemoTasks/BasicTLSMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/DemoTasks/BasicTLSMQTTExample.c index b9c9a7fb4..d6bdda02a 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/DemoTasks/BasicTLSMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/DemoTasks/BasicTLSMQTTExample.c @@ -343,7 +343,7 @@ void vStartSimpleMQTTDemo( void ) * connect, subscribe, publish, unsubscribe, and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/DemoTasks/KeepAliveMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/DemoTasks/KeepAliveMQTTExample.c index 0fff1e0ae..f360cb52b 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/DemoTasks/KeepAliveMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/DemoTasks/KeepAliveMQTTExample.c @@ -441,7 +441,7 @@ void vStartSimpleMQTTDemo( void ) * connect, subscribe, publish, unsubscribe and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/DemoTasks/MultitaskMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/DemoTasks/MultitaskMQTTExample.c index a965848e1..3cad2831d 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/DemoTasks/MultitaskMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/DemoTasks/MultitaskMQTTExample.c @@ -112,11 +112,11 @@ /* If no username is defined, then a client certificate/key is required. */ #ifndef democonfigCLIENT_USERNAME - /* - *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for - *!!! convenience of demonstration only. Production devices should - *!!! store keys securely, such as within a secure element. - */ +/* + *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for + *!!! convenience of demonstration only. Production devices should + *!!! store keys securely, such as within a secure element. + */ #ifndef democonfigCLIENT_CERTIFICATE_PEM #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." @@ -859,7 +859,7 @@ void vStartSimpleMQTTDemo( void ) * MQTT operations, and creates additional tasks to add operations to that * queue. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY + 1, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/DemoTasks/MutualAuthMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/DemoTasks/MutualAuthMQTTExample.c index e4d96ccc9..11896d3f5 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/DemoTasks/MutualAuthMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/DemoTasks/MutualAuthMQTTExample.c @@ -73,11 +73,11 @@ /* If no username is defined, then a client certificate/key is required. */ #ifndef democonfigCLIENT_USERNAME - /* - *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for - *!!! convenience of demonstration only. Production devices should - *!!! store keys securely, such as within a secure element. - */ +/* + *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for + *!!! convenience of demonstration only. Production devices should + *!!! store keys securely, such as within a secure element. + */ #ifndef democonfigCLIENT_CERTIFICATE_PEM #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." @@ -432,7 +432,7 @@ void vStartSimpleMQTTDemo( void ) * connect, subscribe, publish, unsubscribe and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/DemoTasks/PlaintextMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/DemoTasks/PlaintextMQTTExample.c index a644dcbbe..cb25ff590 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/DemoTasks/PlaintextMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/DemoTasks/PlaintextMQTTExample.c @@ -327,7 +327,7 @@ void vStartSimpleMQTTDemo( void ) * connect, subscribe, publish, unsubscribe and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c index 772c833bd..9efd40578 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c @@ -383,7 +383,7 @@ void vStartSimpleMQTTDemo( void ) * connect, subscribe, publish, unsubscribe and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTSerializerDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c index 7f12ff632..a6c9698e5 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c @@ -299,7 +299,7 @@ void vStartPKCSMutualAuthDemo( void ) * connect, subscribe, publish, unsubscribe and disconnect from the MQTT * broker. */ xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */ - "MQTTDemo", /* Text name for the task - only used for debugging. */ + "DemoTask", /* Text name for the task - only used for debugging. */ democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ NULL, /* Task parameter - not used in this case. */ tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ |