6.2 Loggers

A CEF logger is used by components to log operations.


TCEF_Logger is the means by which CEF logs component operations. The class has the following methods:


void Attach


Increments the object's reference count.


void Detach


Decrements the object's reference count. If the reference count reaches 0 (or less), the object destructs itself.


integer Get_Data_Radix


Returns the data radix for logging. See the Set_Data_Radix for details on the values.


integer Get_Options


Returns the current logging options. See Set_Options for details on the values.


boolean Get_Paused


Returns true if logging is paused.


integer Get_Wrap_Column


Returns the column at which data is wrapped. See Set_Wrap_Column.


void Set_Data_Radix( integer Value )


Radix to use for logged data. This has no effect on non-data logging.
Value Mnuemonic Description
0 CEF_LR_Print_Friendly Print-friendly ASCII string (control codes replaced with ".")
1 CEF_LR_ASCII Literal ASCII string
2-36 Base to represent data in
37-49 reserved for future use
50 CEF_LR_Radix50 Radix 50 representation
51 CEF_LR_EBCDIC Convert data from EBCDIC to ASCII
52+ reserved for future use


void Set_Options( integer Value )


Sets the logging options. The values are:
Value Mnuemonic Description
1 LO_Append Append to existing log file.
2 LO_Include_TimeStamp Include Timestamp in log.
4 LO_Include_Name Include Component name in log.
8 LO_Hide_Execution Hide execution logs.
16 LO_Hide_Data Hide data logs.
32 LO_Hide_Sent_Signal Hide sent signal logs.
64 LO_Hide_Received_Signal Hide received signal logs.
128 LO_Hide_State_Change Hide state change logs.
256 LO_Hide_Read Hide read operation logs.
512 LO_Hide_Write Hide write operation logs.
1024 LO_Hide_Input Hide input operation logs.
2048 LO_Hide_Output Hide output operation logs.
4096 LO_Hide_Other Hide logs not covered by other options.


void Set_Paused( boolean Value )


Pauses the logging if Value is True and resumes logging if the Value is False.


void Set_Wrap_Column( integer Value )


Sets the column where data wraps. The logger will output up to this many characters before starting a new line. If 0, the logger does no wrapping.


void Set_UI( TUI_Interface* Value )


Set UI component for the logger (for retrieving clock times, etc.)


string Filename


Returns name of current log file.


boolean Open( string Filename, boolean Append )


Open the specified file as the log file. If Append is true, the existing file is appended to. If the file doesn't exist it is created. If Append is false, any existing file is overwritten. Returns True if the file was opened and false otherwise.


void Terminate


Terminate the logger instance. This should be done via the Deatch call.


void Log( TComponent* C, string S, integer Len, boolean Continuation, integer Log_Type )


Log an item to the log file. S is the data to log. Len is the length of S. If Len is -1, S is assumed to be null-terminated. Continuation is false if this is the first item of a log operation. If continuation is true, this is considered to be part of the preceeding log item. Log_Type indicates the type of information being logged, as follows:
Value Mnuemonic Description
0 LT_Execution Sent at the start of an operation (eg CPU instruction execution).
1 LT_Data Data.
2 LT_Sent_Signal Sent signal.
3 LT_Received_Signal Received signal.
4 LT_State_Change State change.
5 LT_Read A read request (memory or memory-like component).
6 LT_Write A write request (memory or memory-like component)
7 LT_Input An input request.
8 LT_Output An output request.
9 LT_Other Some situation not covered by other log types.


void Update( TComponent* C, int64 PC, int64 I )


Log an item to the log file. The logger gathers the state from the component and does the log. This is used for CPUs and the PC corresponding to the beginning of the current instruction is passed. I is the instruction about to be executed. This should be called after the instruction is fetched but before it is executed.