Event logging

Embed provides a simple function for logging events. You are encouraged to write your own function to send events to an embedded display device of your choice or send them to a log file. The source code for the supplied function is provided below:

 

/*************************************************************************

* (C) Copyright 1989-2021 Altair Engineering *

* All Rights Reserved *

* This software may not be used, copied or made available to anyone, *

* except in accordance with the license under which it is furnished. *

*************************************************************************/

 

#include <stdio.h>

#include <stdlib.h>

#include "vsuser.h"

 

// VisSim generates this call for each event log block

// Write your own version of this function to display log events on your device,

// or log events to a file

// eventType corresponds to the type input, eventName corresponds to the event input

// eventClass corresponds to the "Label" field in the eventLog dialog.

void vsmLogEvent( int eventType, const char *eventName, const char *eventClass)

{

const char *messageType="??";

switch (eventType) {

case tvsmEventMessage:

messageType = "Info";

break;

case tvsmEventWarning:

messageType = "Warning";

break;

case tvsmEventError:

messageType = "Error";

break;

}

 

printf( "%s\t", messageType );

if (!eventClass)

eventClass = "Unclassified";

printf( "%s: %s\n", eventClass, eventName);

}