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 most filter parameters possible for selection of log entries.  Use this function when you need a very precise set of log entries.


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

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.

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.

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_FullFilter(ByVal StartDate As Date, ByVal EndDate As Date, _
                                       ByVal mType As String, ByVal mEntry As String, ByVal mEntry_RegEx As Boolean, _
                                       ByVal Pri_Start As Integer, ByVal Pri_End As Integer, ByVal Show_NoPri As Boolean, _
                                       ByVal ErrorCode As Integer, ByVal ShowAllErrorCode As Boolean) _
                 As LogEntry()

This example retrieves all log entries from a week ago to today, with a type of "Error", and a priority between 1 and 3 inclusive or unprioritized (Priority = 0):

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


  • No labels