Attribute VB_Name = "modLog"
Option Explicit
Private msLogLatest As String
Private moLogFile As TextStream
'-----------------------------------------------
' Open the log file
'------------------------------------------
Public Sub OpenLogFile(ByRef rsLogFileName As String)
Set moLogFile = goFS.OpenTextFile(rsLogFileName, ForReading, True)
End Sub
'--------------------------------------
' Read a line of text from the log variable.
'---------------------------------------
Public Function ReadLogLine(ByRef rsOut As String) As Boolean
xReadLog
Dim lX As Long
lX = xLogLineAvailable
If lX Then
ReadLogLine = True
rsOut = Left$(msLogLatest, lX - 1)
msLogLatest = Mid$(msLogLatest, lX + Len(vbCrLf))
End If
End Function
'-----------------------------------------
' read whatever is in the log file into a holding variable, return true if there was something to read.
'------------------------------------------
Private Function xReadLog() As Boolean
If Not moLogFile.AtEndOfStream Then
msLogLatest = moLogFile.ReadAll
xReadLog = True
End If
' Debug.Assert InStr(1, msLogLatest, gsFINISHED, vbTextCompare) = 0
End Function
Private Function xLogLineAvailable() As Long
xLogLineAvailable = InStr(msLogLatest, vbCrLf)
End Function