Skip to end of metadata
Go to start of metadata

Purpose

This function retrieves entries from the system log database and returns them as an array of LogEntry structures.  This function provides filtering of the log entries by date, and the error code associated with the log entry.


Parameters

Parameter: StartDate
Type: Date/Time
Description: This is the starting date for the log entries that you want retrieved.  If you do not care about a starting date, use Date.MinValue

Parameter: EndDate
Type: Date/Time
Description: This is the ending (latest) date for the log entries that you want retrieved.  If you do not care about an ending date, use Date.MaxValue

Parameter: ErrorCode
Type: Integer
Description: This is the error code to select records with.  Use a value of -1 (Or use ShowAllErrorCode) if you do not care to filter log entries using the Error Code value.  Error codes are provided by the procedure that added the log entry - they are not standardized.  Consult the author of 3rd party provided scripts and plug-ins to obtain a list of error codes that they may have used.

Parameter: ShowAllErrorCode
Type: Boolean
Description: When set to True, the ErrorCode parameter is ignored and all log entries that match the other filters are returned.


Returns

Return value: LogEntry
Type: Array of Structure LogEntry
Description: See LogEntry Structure.


Example

Sample Code
Function GetLog_Date_ErrorCode(ByVal StartDate As Date, ByVal EndDate As Date, _
		ByVal ErrorCode As Integer, ByVal ShowAllErrorCode As Boolean) _
	As LogEntry()

This example retrieves all log entries from a week ago to today, with an error code of 4166:

Sample Code
Dim Logs() As HomeSeerAPI.LogEntry
	Logs = hs.GetLog_Date_ErrorCode(Now.AddDays(-7), Now, 4166, False)
	If Logs IsNot Nothing AndAlso Logs.Count > 0 Then
    hs.WriteLog("Info", Logs.Count.ToString & " log entries retrieved, and this just added another!")
End If


  • No labels