how to convert my logging function to a Class
What I have been doing is setup constants for I=Information, E=Error,
W=Warning
'**********The start of every script I get the filename.
Source=Split(WScript.ScriptName, ".")(0)
LogIt I, Source, "This is a test" 'This would log to my file as a
information message.
Private Function LogIt (byVal strSeverity, strSource, strMessage)
'************************************************* ********
' Name: LogIt
' Purpose: Sends an entry to the debug log and displays to
' the screen
'************************************************* ********
Wscript.StdOut.WriteLine Now & "|" & strSource & "|" & strMessage
'If log file initialized write line to that
If Not IsEmpty(objLogFile) Then
objLogFile.Writeline Now & "|" & strSeverity & "|" & strSource & "|" &
strMessage
End If
End Function
*************************************
What I would like to do is be able to add properties to the LogIt Function
For example,
LogIt.Information Source, "This is a test"
LogIt.Error Source, "This is a test"
LogIt.Warning Source, "This is a test"
I have no idea how to do that. Any help is definently appreacited. Also, to
make this simple example in post, I actally use this LogIt function in
another script and use WSF file to leverage resuable code.
|