Log the Duration of a Check
This example calculates the duration of a check and writes the number of seconds to a CSV log file (c:\wswlogs\log23.txt).
The number of seconds is also written to the additional info field #1, which can be displayed as a column in the bookmark list.
Global variables can be defined at the beginning of the Plugin.
' Global variables that can be used in all event functions
Dim $sLogfile = "c:\wswlogs\log23.txt"
Dim $dStart = ""
'*******************************************************************************
Sub Wsw_BeforeCheck()
Bookmark_SetProperty("checkmethod", "content")
$dStart = Now
End Sub
'*******************************************************************************
Sub Wsw_AfterCheck(ByRef $sStatusMessage)
Dim $sSeconds = DateDiff(Now, $dStart, "s")
' Write seconds into additional info field/column
Bookmark_SetProperty("infofield1", $sSeconds + " sec")
' Write URL and seconds into log file
If $sLogfile <> "" Then
AddStringToFile($sLogfile, """" + Bookmark_GetProperty("check_url") + """;""" + $sSeconds + """" + CRLF)
End If
End Sub