Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
General Function - Log ErrorThis function writes details of an error to the Application Event Log, using the function Log Event. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Sub zGen_LogError(sApp, sModule, iLine, iErr, sErrDesc, sErrSrce) 'Writes Errors to the Application Event Log Dim sDesc Const LOG_ERROR = 1 sDesc = "zGenLogError:" & vbcrlf & vbcrlf sDesc = sDesc & "In App :" & vbTab & sApp & vbcrlf sDesc = sDesc & "In Mod :" & vbTab & sMod & vbcrlf sDesc = sDesc & "At Line :" & vbTab & cStr(iLine)& vbcrlf sDesc = sDesc & "Err Num :" & vbTab & cStr(iErr) & vbcrlf & vbcrlf sDesc = sDesc & "Description:" & vbcrlf & sErrDesc & vbcrlf & vbcrlf sDesc = sDesc & "Source:" & vbcrlf & sErrSrce Call zGen_LogEvent(LOG_ERROR, sDesc) End Sub '========================================================================= |