在QTP运行过程中输出txt文件
上一篇 /
下一篇 2008-08-21 13:52:48
Function WriteLog(LogContent)
logfile=LogName
Const forappending=8
Set ōbjFSO=CreateObject("scrīpting.FileSystemObject")
Set ōbjTextFile=objFSO.OpenTextFile(LogFile,forappending,true)
objTextFile.WriteLine now&chr(9)&chr(9)&LogContent
objTextFile.close
End function
Function LogName
Gethostname hostname
Month1=Month(now)
If month1 >0 and Month1<10 Then
LongMonth="0" & cstr(Month1)
else
longmonth=month1
End If
day1=day(now)
If day1 >0 and day1<10 Then
Longday="0" & cstr(day1)
else
longday=day1
End If
hour1=hour(now)
If hour1 >0 and hour1<10 Then
Longhour="0" & cstr(hour1)
else
longhour=hour1
End If
LogName="Z:\Logs\" &hostname &"_"& year(now) & longmonth & longday & longhour &".txt"
End Function
使用:
WriteLog("Test Pass")
生成的日志为:
8/12/2008 8:10:19 PM Test Pass
收藏
举报
TAG: