GetLog_Date_Priority
Purpose
This function retrieves entries from the system log database and returns them as an array of LogEntry structures. This function provides filtering the entries using the date and priority.
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: Pri_Start
Type: Integer
Description: This is the starting priority for log entries to be retrieved. If you wish to retrieve log entries which are priority 1 through 5, provide a value of 1 here and a value of 5 in the Pri_End parameter. If you do not need to filter by priority, use the value -1.
Parameter: Pri_End
Type: Integer
Description: This is the ending priority value for the log entries to be retrieved. If you wish to retrieve log entries which are priority 1 through 5, provide a value of 1 in the Pri_Start parameter and a value of 5 in this parameter. If you do not need to filter by priority, use the value -1.
Parameter: Show_NoPri
Type: Boolean
Description: When set to True, unprioritized entries (Priority = 0) are included in the selection in addition to the priorities selected with Pri_Start and Pri_End.
Returns
Return value: LogEntry
Type: Array of Structure LogEntry
Description: See LogEntry Structure.
Example
Sample Code
Function GetLog_Date_Priority(ByVal StartDate As Date, ByVal EndDate As Date, _
ByVal Pri_Start As Integer, ByVal Pri_End As Integer, ByVal Show_NoPri As Boolean) _
As LogEntry()
This example retrieves all log entries from a week ago to today, with a priority between 1 and 3 inclusive or unprioritized (Priority = 0):
Sample Code
Dim Logs() As HomeSeerAPI.LogEntry
Logs = hs.GetLog_Date_Priority(Now.AddDays(-7), Now, 1, 3, True)
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