mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-23 11:09:28 -05:00
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>
This commit is contained in:
parent
9939374379
commit
1876800382
9 changed files with 22 additions and 19 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
/* 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.
|
||||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
/* 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.
|
||||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue