Skip to content

Commit

Permalink
Merge pull request #1611 from skliper/fix1325-syslog_func
Browse files Browse the repository at this point in the history
Fix #1325, Prepend system log messages with function name
  • Loading branch information
astrogeco committed Jun 15, 2021
2 parents e54e908 + abe68b5 commit 8752126
Show file tree
Hide file tree
Showing 33 changed files with 412 additions and 483 deletions.
2 changes: 1 addition & 1 deletion modules/cfe_assert/src/cfe_assert_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId)
status = OS_MutSemCreate(&CFE_Assert_Global.AccessMutex, "CFE_Assert", 0);
if (status != OS_SUCCESS)
{
CFE_ES_WriteToSysLog("%s(): OS_MutSemCreate failed, rc=%d\n", __func__, (int)status);
CFE_ES_WriteToSysLog("%s: OS_MutSemCreate failed, rc=%d\n", __func__, (int)status);
return CFE_STATUS_EXTERNAL_RESOURCE_FAIL;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int32 CFE_Assert_RegisterTest(const char *TestName)
CFE_EVS_EventFilter_BINARY);
if (rc != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Error from CFE_EVS_Register: %08lx\n", (unsigned long)rc);
CFE_ES_WriteToSysLog("%s: Error from CFE_EVS_Register: %08lx\n", __func__, (unsigned long)rc);
return rc;
}

Expand All @@ -124,7 +124,7 @@ int32 CFE_Assert_RegisterTest(const char *TestName)
rc = CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_TESTRUNNER_MAX_STARTUP_WAIT);
if (rc != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Error while waiting for OPERATIONAL state: %08lx\n", (unsigned long)rc);
CFE_ES_WriteToSysLog("%s: Error while waiting for OPERATIONAL state: %08lx\n", __func__, (unsigned long)rc);
return rc;
}

Expand Down Expand Up @@ -206,7 +206,7 @@ void CFE_Assert_ExecuteTest(void)
rc = CFE_ES_GetAppID(&AppId);
if (rc != CFE_SUCCESS || !CFE_RESOURCEID_TEST_EQUAL(AppId, CFE_Assert_Global.OwnerAppId))
{
CFE_ES_WriteToSysLog("%s(): Invalid calling context, CFE_ES_GetAppId() rc=%08x AppId=%lx, OwnerAppId=%lx\n",
CFE_ES_WriteToSysLog("%s: Invalid calling context, CFE_ES_GetAppId() rc=%08x AppId=%lx, OwnerAppId=%lx\n",
__func__, (unsigned int)rc, CFE_RESOURCEID_TO_ULONG(AppId),
CFE_RESOURCEID_TO_ULONG(CFE_Assert_Global.OwnerAppId));
return;
Expand Down
179 changes: 60 additions & 119 deletions modules/core_private/ut-stubs/src/ut_osprintf_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,123 +41,64 @@
*/

const char *UT_OSP_MESSAGES[] = {
[0] = NULL, /* Message 0 is reserved */
/* ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_MOUNT_VOLATILE] = "ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
/* CFE_ES_ExitApp: CORE Application CFE_ES Had a Runtime Error. */
[UT_OSP_CORE_RUNTIME] = "CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n",
/* ES Startup: OS_TaskCreate error creating core App: CFE_TBL: EC = 0x~ */
[UT_OSP_CORE_APP_CREATE] = "ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n",
/* ES Startup: Error returned when calling function: CFE_TBL_EarlyInit: EC = 0x~ */
[UT_OSP_EARLYINIT] = "ES Startup: Error returned when calling function: %s: EC = 0x%08X\n",
/* ES Startup: Could not find Library Init symbol:TST_LIB_Init. EC = 0x~ */
[UT_OSP_FIND_LIBRARY] = "ES Startup: Could not find Library Init symbol:%s. EC = %d\n",
/* POWER ON RESET due to max proc resets (HW Spec Cmd). */
[UT_OSP_POR_MAX_HW_SPECIAL] = "POWER ON RESET due to max proc resets (HW Spec Cmd).\n",
/* CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = ~ */
[UT_OSP_CANNOT_CALL_APP_MAIN] = "CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %d\n",
/* ES Startup: bad function pointer ( table entry = 1). */
[UT_OSP_FUNCTION_POINTER] = "ES Startup: bad function pointer ( table entry = %d).\n",
/* ES Startup: Error Reading Startup file. EC = 0x~ */
[UT_OSP_STARTUP_READ] = "ES Startup: Error Reading Startup file. EC = 0x%08X\n",
/* PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded). */
[UT_OSP_PROC_RESET_COMMANDED] = "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n",
/* ES SharedData Mutex Take Err Stat=0x~,App=1,Func=TestAPI,Line=12345 */
[UT_OSP_MUTEX_TAKE] = "ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n",
/* ES Startup: Startup Sync failed - Applications may not have all started */
[UT_OSP_STARTUP_SYNC_FAIL_1] = "ES Startup: Startup Sync failed - Applications may not have all started\n",
/* Warning: System Log full, log entry discarded. */
[UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n",
/* ES Startup: ES Startup File Line is too long: 137 bytes. */
[UT_OSP_FILE_LINE_TOO_LONG] = "ES Startup: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n",
/* ES Startup: Load Shared Library Init Error. */
[UT_OSP_SHARED_LIBRARY_INIT] = "ES Startup: Load Shared Library Init Error = 0x%08x\n",
/* ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_REMOVE_VOLATILE] = "ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n",
/* POWER ON RESET due to other cause (See Subtype). */
[UT_OSP_POR_OTHER] = "POWER ON RESET due to other cause (See Subtype).\n",
/* ES Startup: Error Determining Blocks Free on Volume. EC = 0x~ */
[UT_OSP_DETERMINE_BLOCKS] = "ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n",
/* ES Startup: Startup Sync failed - Applications may not have all initialized */
[UT_OSP_STARTUP_SYNC_FAIL_2] = "ES Startup: Startup Sync failed - Applications may not have all initialized\n",
/* ES Startup: No free library slots available */
[UT_OSP_LIBRARY_SLOTS] = "ES Startup: No free library slots available\n",
/* ES Startup: Unable to extract filename from path: ut/filename.gz. */
[UT_OSP_EXTRACT_FILENAME_UT] = "ES Startup: Unable to extract filename from path: %s.\n",
/* ES Startup: Application path plus file name length (~) exceeds max allowed (~) */
[UT_OSP_APP_PATH_FILE_TOO_LONG] =
"ES Startup: Application path plus file name length (%d) exceeds max allowed (%d)\n",
/* ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_REFORMAT_VOLATILE] = "ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n",
/* ES Startup: Could not load cFE application file:ut/filename.x. EC = 0x~ */
[UT_OSP_EXTRACT_FILENAME_UT55] = "ES Startup: Could not load file:%s. EC = 0x%08X\n",
/* ES Startup: Unable to extract filename from path: ut46/ */
[UT_OSP_EXTRACT_FILENAME_UT46] = "ES Startup: Unable to extract filename from path: %s.\n",
/* ES Startup: No free application slots available */
[UT_OSP_NO_FREE_APP_SLOTS] = "ES Startup: No free application slots available\n",
/* ES Startup: Unable to extract filename from path: ut57/ */
[UT_OSP_EXTRACT_FILENAME_UT57] = "ES Startup: Unable to extract filename from path: %s.\n",
/* ES SharedData Mutex Give Err Stat=0x~,App=1,Func=TestAPI,Line=98765 */
[UT_OSP_MUTEX_GIVE] = "ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n",
/* ES Startup: Could not find symbol:EntryPoint. EC = 0x~ */
[UT_OSP_CANNOT_FIND_SYMBOL] = "ES Startup: Could not find symbol:%s. EC = 0x%08X\n",
/* ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_INIT_VOLATILE] = "ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n",
/* ES:Application Init Failed,RC=0x~ */
[UT_OSP_APP_INIT] = "ES:Application Init Failed,RC=0x%08X\n",
/* POWER ON RESET due to max proc resets (Commanded). */
[UT_OSP_POR_MAX_PROC_RESETS] = "POWER ON RESET due to max proc resets (Commanded).\n",
/* CFE_ES_RestartApp: Cannot Restart Application appName, It is not running. */
[UT_OSP_CANNOT_RESTART_APP] = "CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n",
/* ES Startup: Insufficent Free Space on Volatile Disk, Reformatting. */
[UT_OSP_INSUFF_FREE_SPACE] = "ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n",
/* ES Startup: Could not load cFE Shared Library */
[UT_OSP_LOAD_SHARED_LIBRARY] = "ES Startup: Could not load cFE Shared Library\n",
/* POWER ON RESET due to HW Special Cmd (Hw Spec Cmd). */
[UT_OSP_POR_HW_SPECIAL] = "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n",
/* ES Startup: AppCreate Error: TaskCreate AppName Failed. EC = 0x~! */
[UT_OSP_APP_CREATE] = "ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n",
/* ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_CREATE_VOLATILE] = "ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n",
/* ES Startup: Failed to unload APP: AppName. EC = 0x~ */
[UT_OSP_MODULE_UNLOAD_FAILED] = "ES Startup: Failed to unload: %s. EC = 0x%08X\n",
/* POWERON RESET called from CFE_ES_ResetCFE (Commanded). */
[UT_OSP_POR_COMMANDED] = "POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n",
/* ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_REMOUNT_VOLATILE] = "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
/* CFE_ES_ExitApp, Cannot Exit CORE Application CFE_ES */
[UT_OSP_CORE_APP_EXIT] = "CFE_ES_ExitApp, Cannot Exit CORE Application %s\n",
/* ES Startup: Opened ES App Startup file: */
[UT_OSP_ES_APP_STARTUP_OPEN] = "ES Startup: Opened ES App Startup file: %s\n",
/* CFE_ES_ExitApp: CORE Application CFE_ES Had an Init Error. */
[UT_OSP_CORE_INIT] = "CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n",
/* PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd). */
[UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n",
/* ES:Error reading cmd pipe,RC=0x~ */
[UT_OSP_COMMAND_PIPE] = "ES:Error reading cmd pipe,RC=0x%08X\n",
/* ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x~ */
[UT_OSP_UNMOUNT_VOLATILE] = "ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
/* ES Startup: Error: ES_TaskTable slot in use at task creation! */
[UT_OSP_TABLE_SLOT_IN_USE] = "ES Startup: Error: ES_TaskTable slot in use at task creation!\n",
/* ES Startup: Error, Can't Open ES App Startup file: */
[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n",
/* ES Startup: Unable to extract filename from path: /cf/apps/tst_lib.bundle.gz. */
[UT_OSP_EXTRACT_FILENAME_CF] = "ES Startup: Unable to extract filename from path: %s.\n",
/* Warning: Invalid System Log mode, log entry discarded. */
[UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n",
/* ES Startup: Library path plus file name length (~) exceeds max allowed (~) */
[UT_OSP_LIB_PATH_FILE_TOO_LONG] = "ES Startup: Library path plus file name length (%d) exceeds max allowed (%d)\n",
/* ES Startup: Unable to decompress Application File: ut/filename.gz */
[UT_OSP_DECOMPRESS_APP] = "ES Startup: Unable to decompress Application File: %s\n",
/* ES Startup: Unable to decompress library file: /cf/apps/tst_lib.bundle.gz */
[UT_OSP_DECOMPRESS_LIBRARY] = "ES Startup: Unable to decompress library file: %s\n",
/* CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = ~, RC = 0x~ */
[UT_OSP_GET_APP_ID] = "CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n",
/* ES Startup: Error, No free application slots available for CORE App! */
[UT_OSP_NO_FREE_CORE_APP_SLOTS] = "ES Startup: Error, No free application slots available for CORE App!\n",
/* ES Startup: CFE_ES_Global.TaskTable record used error for App: CFE_EVS, continuing. */
[UT_OSP_RECORD_USED] = "ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n",
/* CFE_ES_ExitChildTask called from invalid task context */
[UT_OSP_TASKEXIT_BAD_CONTEXT] = "CFE_ES_ExitChildTask called from invalid task context\n",
[UT_OSP_BACKGROUND_TAKE] = "CFE_ES: Failed to take background sem: %08lx\n",
[0] = NULL, /* Message 0 is reserved */
[UT_OSP_MOUNT_VOLATILE] = "%s: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_CORE_RUNTIME] = "%s: CORE Application %s Had a Runtime Error.\n",
[UT_OSP_CORE_APP_CREATE] = "%s: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n",
[UT_OSP_EARLYINIT] = "%s: Error returned when calling function: %s: EC = 0x%08X\n",
[UT_OSP_FIND_LIBRARY] = "%s: Could not find Library Init symbol:%s. EC = %d\n",
[UT_OSP_POR_MAX_HW_SPECIAL] = "%s: POWER ON RESET due to max proc resets (HW Spec Cmd).\n",
[UT_OSP_CANNOT_CALL_APP_MAIN] = "%s: Error: Cannot Call from a cFE App Main Task. ID = %d\n",
[UT_OSP_FUNCTION_POINTER] = "%s: bad function pointer ( table entry = %d).\n",
[UT_OSP_STARTUP_READ] = "%s: Error Reading Startup file. EC = 0x%08X\n",
[UT_OSP_PROC_RESET_COMMANDED] = "%s: PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n",
[UT_OSP_MUTEX_TAKE] = "%s: SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n",
[UT_OSP_STARTUP_SYNC_FAIL_1] = "%s: Startup Sync failed - Applications may not have all started\n",
[UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n",
[UT_OSP_FILE_LINE_TOO_LONG] = "%s: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n",
[UT_OSP_SHARED_LIBRARY_INIT] = "%s: Load Shared Library Init Error = 0x%08x\n",
[UT_OSP_REMOVE_VOLATILE] = "%s: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_POR_OTHER] = "%s: POWER ON RESET due to other cause (See Subtype).\n",
[UT_OSP_DETERMINE_BLOCKS] = "%s: Error Determining Blocks Free on Volume. EC = 0x%08X\n",
[UT_OSP_STARTUP_SYNC_FAIL_2] = "%s: Startup Sync failed - Applications may not have all initialized\n",
[UT_OSP_LIBRARY_SLOTS] = "%s: No free library slots available\n",
[UT_OSP_EXTRACT_FILENAME_UT] = "%s: Unable to extract filename from path: %s.\n",
[UT_OSP_APP_PATH_FILE_TOO_LONG] = "%s: Application path plus file name length (%d) exceeds max allowed (%d)\n",
[UT_OSP_REFORMAT_VOLATILE] = "%s: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_EXTRACT_FILENAME_UT55] = "%s: Could not load file:%s. EC = 0x%08X\n",
[UT_OSP_EXTRACT_FILENAME_UT46] = "%s: Unable to extract filename from path: %s.\n",
[UT_OSP_NO_FREE_APP_SLOTS] = "%s: No free application slots available\n",
[UT_OSP_EXTRACT_FILENAME_UT57] = "%s: Unable to extract filename from path: %s.\n",
[UT_OSP_MUTEX_GIVE] = "%s: SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n",
[UT_OSP_CANNOT_FIND_SYMBOL] = "%s: Could not find symbol:%s. EC = 0x%08X\n",
[UT_OSP_INIT_VOLATILE] = "%s: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_APP_INIT] = "%s: Application Init Failed,RC=0x%08X\n",
[UT_OSP_POR_MAX_PROC_RESETS] = "%s: POWER ON RESET due to max proc resets (Commanded).\n",
[UT_OSP_CANNOT_RESTART_APP] = "%s: Cannot Restart Application %s, It is not running.\n",
[UT_OSP_INSUFF_FREE_SPACE] = "%s: Insufficent Free Space on Volatile Disk, Reformatting.\n",
[UT_OSP_LOAD_SHARED_LIBRARY] = "%s: Could not load cFE Shared Library\n",
[UT_OSP_POR_HW_SPECIAL] = "%s: POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n",
[UT_OSP_APP_CREATE] = "%s: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n",
[UT_OSP_CREATE_VOLATILE] = "%s: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_MODULE_UNLOAD_FAILED] = "%s: Failed to unload: %s. EC = 0x%08X\n",
[UT_OSP_POR_COMMANDED] = "%s: POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n",
[UT_OSP_REMOUNT_VOLATILE] = "%s: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_CORE_APP_EXIT] = "%s: Cannot Exit CORE Application %s\n",
[UT_OSP_ES_APP_STARTUP_OPEN] = "%s: Opened ES App Startup file: %s\n",
[UT_OSP_CORE_INIT] = "%s: CORE Application %s Had an Init Error.\n",
[UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "%s: PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n",
[UT_OSP_COMMAND_PIPE] = "%s: Error reading cmd pipe,RC=0x%08X\n",
[UT_OSP_UNMOUNT_VOLATILE] = "%s: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",
[UT_OSP_TABLE_SLOT_IN_USE] = "%s: Error: ES_TaskTable slot in use at task creation!\n",
[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "%s: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n",
[UT_OSP_EXTRACT_FILENAME_CF] = "%s: Unable to extract filename from path: %s.\n",
[UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n",
[UT_OSP_LIB_PATH_FILE_TOO_LONG] = "%s: Library path plus file name length (%d) exceeds max allowed (%d)\n",
[UT_OSP_DECOMPRESS_APP] = "%s: Unable to decompress Application File: %s\n",
[UT_OSP_DECOMPRESS_LIBRARY] = "%s: Unable to decompress library file: %s\n",
[UT_OSP_GET_APP_ID] = "%s: Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n",
[UT_OSP_NO_FREE_CORE_APP_SLOTS] = "%s: Error, No free application slots available for CORE App!\n",
[UT_OSP_RECORD_USED] = "%s: Error: ES_TaskTable slot for ID %lx in use at task creation!\n",
[UT_OSP_TASKEXIT_BAD_CONTEXT] = "%s: Called from invalid task context\n",
[UT_OSP_BACKGROUND_TAKE] = "%s: Failed to take background sem: %08lx\n",
};
Loading

0 comments on commit 8752126

Please sign in to comment.