About Debugging

GentranEx.DLL enables you to gather information from any translation session executed on the machine on which GentranEx.DLL is installed, and write that information to a log file. This function does not require any interaction from the user and thus is an efficient alternative to using the Messagebox function when debugging map.

Each entry made to the log file contains the following information, which provides clarity and readability to the log:

  • date and time stamp
  • name of the log owner
  • source of the message
  • the message

The name of the log owner, the source of the message, and the message are all supplied by the user via the OpenLog() and WriteLog() functions.

Implementing Debugging

Prog ID

"GentranEx.TraceLog"

Interface ID

{7DA17F77-8090-11D2-ABE4-00C04FF3971C}
Table 1. Debugging Methods
Method Description
short OpenLog(BSTR PathFilename, BSTR Owner, short WriteMode)
  • Returns "1" for success, "-1" for failure, and "-2" if the file is already open.
  • Argument 1 is the path and filename of the log file to be created.
  • Argument 2 is the owner of the log. This value is written to the log file and is included to make the log easier to read.
  • Argument 3 is the writemode (for example, 1 = append (this is the default) and 2 = truncate).
  • The "Owner" column in the generated log file is 20 characters wide — therefore Argument 2 is truncated at that value (20) when written to the log file.
short Open() Opens a trace log file (named "GentranTrace.log") in the GENSRVNT home directory. The file is opened in Append mode and is assigned an Owner name of "GentranEx".
short WriteLog(BSTR Source, BSTR Message)
  • Returns "1" for success and "-1" for failure.
  • Argument 1 is the source of the message that is written.
  • Argument 2 is the message text. Both Arguments 1 and 2 are written in separate columns in the log file for clarity.
  • The "Source" column in the log file is 20 characters wide and thus Argument 1 is truncated at that value (20).
  • The "Message" column in the log file is 256 characters wide and thus Argument 2 of this function is truncated at that value when written to the log file.
BSTR GetLastError() Returns a string containing the error of the most recent attempt to open the log file.
short CloseLog() Closes the log file and returns "1" for success or "-1" for failure.
Note: The file should always be closed before your trace object goes out of scope.

Properties: None.

Extended rule example

This is an example of an extended rule using GentranEx.DLL for debugging.

Object obTrace;
Integer result;
String [32] szPartnerKEY;

obTrace = CreateObject ("GentranEx.TraceLog");
result = obTrace.OpenLog("D:\GENSRVNT\TraceTest.txt","ICLANA",2);
if result = -1 then
  Begin
    obTrace.WriteLog("Start of Log", "Trace Test");
    obTrace.WriteLog("Converted TUN#",szPartnerKEY);
  End
obTrace.CloseLog();
deleteobject(obTrace);