Debug messages complete code
This page contains the complete code of Debug messages.
In Log.cpp
, your Debug message code should be as follows:
Copy
#include "RT_Project_01.h"
#include <wchar.h>
int DebugMessages()
{
RtPrintf("Display customized messages in Analysis Console.\n\n");
//Set log IDs and names.
SetCategoryName(0, L"Temperature");
SetCategoryName(1, L"Voltage");
SetCategoryName(2, L"Warning");
//Initialize log names to NULL.
wchar_t Log0[] = L"NULL";
wchar_t Log1[] = L"NULL";
wchar_t Log2[] = L"NULL";
//Get the log names.
GetCategoryName(0, Log0);
wprintf(L"Log 0 is: %s\n", Log0);
GetCategoryName(1, Log1);
wprintf(L"Log 1 is: %s\n", Log1);
GetCategoryName(2, Log2);
wprintf(L"Log 2 is: %s\n\n", Log2);
//Display the user log in Analysis Console.
DebugMessage(0, logInfo, L"Melting temperature of metal", TRUE, 328, 660, 1860, 1204);
DebugMessage(1, logInfo, L"Voltage of power", TRUE, 23, 12, 60, 45);
DebugMessage(2, logInfo, L"Warning levels", TRUE, 0, 1, 0, 1);
return 0;
}
Output: