Overview

Most simply, logs are produced by Data objects. These are temporal - that is, they represent a stream of data over the execution period. Sometimes, it will be appropriate for Processes to generate a log as well. These will, generally, be non-temporal. For instance, a final state of a Process may be of interest, and this can be output in the Process log. It is possible for a Process to generate temporal output in its log, but you should consider generating an output that carries this information, instead, since this gives the user more control over collection of this data.

Example

This example is taken from the ScratchBot artifact of the ICEA project. We only show EVENT_LOG_TERM, since we take no action in EVENT_LOG_INIT.

C++ Source Code (against 1199)
case EVENT_LOG_TERM: { // extract passed data EventLog* data = (EventLog*) event->data; // create a new XML node and return it XMLNode xmlNode(hComponent, (const char*) NULL); data->result = xmlNode.element; // wrap it in a DataML node DataMLNode nodeLog(&xmlNode); // create a field "comms" VSTRING names; names.push_back("comms"); nodeLog.becomeStruct(Dims(1), names); DataMLNode nodeComms = nodeLog.getField("comms"); nodeLog.precision(data->precision); // store comms times for review VDOUBLE t; for (int n=0; n<NUMPACKETS; n++) t.push_back(t_comms[n].read); for (int n=0; n<NUMPACKETS; n++) t.push_back(t_comms[n].write); nodeLog.setArray(Dims(NUMPACKETS, 2), t); // format root node as DataML nodeLog.setRootTags(); // ok return C_OK; }