mr toad's wild ride

someone might be able to use it...

09:18 AM, April 10, 2006 .. 0 comments .. Link
i guess this is borrowed from vb for testers my mary romero sweeney so


Private Const LOGFILE = "c:\CW\VB\fResults.txt" 'change this to your logfile storage folder
Dim fs As FileSystemObject
Dim tLog As TextStream
Private Const Appname = "Test Log" 'change this to your appname

Sub LogToFile(strLogText As String)
    Static lLogNum As Long

    'create FSO
    Set fs = CreateObject("Scripting.FileSystemObject")
   
    'increment log number counter
    lLogNum = lLogNum + 1
    'if firstline then create text file & write starting tests line
    If (lLogNum = 1) Then
        Set tLog = fs.CreateTextFile(LOGFILE, True)
        tLog.WriteLine ("Starting Tests on " & Appname & " " & Now)
    Else
        Set tLog = fs.OpenTextFile(LOGFILE, ForAppending)
    End If
   
    'write data to file
    Dim strTemp As String
    strTemp = lLogNum & "," & strLogText & "," & Now
    tLog.WriteLine (strTemp)
   
    tLog.Close

    'print to debug window
    Debug.Print strTemp

End Sub

then call it with
    LogToFile "I just logged this"

it is monday morning and my PM just got in so I should do some work. hope this is useful for someone... or if it could be improved then any tips would be appreciated.

cheers


chris



{ Last Page } { Page 7 of 12 } { Next Page }

About Me

Home
My Profile
Archives
Friends
My Photo Album

Links


Categories

Articles
Books

Recent Entries

Preparation for a new job
Testing Tools
phil started me on a screed... thanks mate.
my delicious account
articles and effective software testing

Friends

neillmccarthy
philk10
jimhazen
thepthial
PeteNairn
EklecticTester