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 the ability to filter on date and the log entry text fields of type and message.  Use this function when you are looking for specific log entries without knowing the priority or error codes.


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: mType
Type: String
Description: This is the log entry type, such as "Info" or "Error" - these must EXACTLY match what you are searching for - leave empty to not use this.

Parameter: mEntry
Type: String
Description: This is the entry text to find.   This is an exact match field unless wildcards or RegEx (next parameter) is used.  To use a wildcard, use the percent (%) character.  For example, to match everything that starts with "Super", use "Super%" which will match SuperDuper, Super Cool, and Super Delicious.

Parameter: mEntry_RegEx
Type: Boolean
Description: When this parameter is TRUE, the previous parameter (mEntry) contains a Regular Expression to be run on the log message field retrieved from the database.   For help with Regular Expressions, see Regular-Expressions.info


Returns

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


Example

Sample Code
Function GetLog_Date_Text(ByVal StartDate As Date, ByVal EndDate As Date, _
                                          ByVal mType As String, ByVal mEntry As String, ByVal mEntry_RegEx As Boolean) _
                 As LogEntry()

This example retrieves all log entries from a week ago to today, with a type of "Error":

Sample Code
Dim Logs() As HomeSeerAPI.LogEntry
	Logs = hs.GetLog_Date_Text(Now.AddDays(-7), Now, "Error", "", 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