How to Customize log string for the program header

Knowledge Base Article # Q200062

Read Prior Article Read Next Article
Summary Using print and the SetLogOff you can customize the log output that is generated when the program starts
  
Login to rate article
Solution:

ATEasy generates the following test log string when a program is start to run. The output is generated after the Program Init events are called as shown here:
  
Program  : Program5  
UUT  :  
Serial #  :  
Start time  : 6/9/2004 9:21:46 AM

--------------------------------------------------------------------------------

To customize the test log program start string you need to add some code of the Program Events OnInit() and OnInitTask(). If the change is for all programs in the project you can place ad the same code in the System Events OnInitProgram() and OnInitTask().

The code in OnInit/OnInitProgram should load the your form with the special serial number / uut information and than set the log off to prevent ataesy from output it log string and than, output your own customized log string.  

Program.OnInit() or System.OnInitProgram()
{

! display my serial num form
Load frmMySerialNum

! Take control over log printing for this event!
SetLogOff()

! print to log (two ways

! one way is to modify the ateasy log string
! s=GetLogString()
! modify s using Mid., Pos etc
! print s

! second way is to output a completly new string, (shown here is the default log string)

print "<TABLE class=Header border=0>;" \
   "<TBODY>"; \
   "<TR>"; \
   "<TD class=Program align=left width=\"15%\">Program"; \
   "<TD class=Program align=left width=\"85%\">: Program5"; \
   "<TR>"; \
   "<TD align=left width=\"15%\">UUT"; \
   "<TD align=left width=\"85%\">: "; \
   "<TR>"; \
   "<TD align=left width=\"15%\">Serial #"; \
   "<TD align=left width=\"85%\">: "; \
   "<TR>"; \
   "<TD align=left width=\"15%\">Start time"; \
   "<TD align=left width=\"85%\">: 6/9/2004 9:21:46 AM"; \
   "</TR>"; \
   "</TBODY>"; \
   "</TABLE>"; \
   "<HR width=\"100%\">"
}


The code shown above is for HTML test log you can make your program works for HTML and Text by using the Log.PlainText property:

If Log.PlanText
    ! print text
else
    ! print HTML
endif


You can figure out the ATEasy default log string by right clicking on the log window and selecting View Source from the menu.

Finally in OnInitTask we have to enable the log again:

Program.OnInitTask()
{
    SetLogOn()
}

Article Date 6/9/2004
Keywords ATEasy, ALog, Header


Login to rate article

Read Prior Article Read Next Article
>