' ****************************************************** ' * ' * Name: tstAppLogging.vbs ' * ' * Design Phase: ' * Author: John Miner ' * Date: 06/30/2008 ' * Purpose: A test program to write application logs. ' * ' ****************************************************** ' ' Declare all variables ' Option Explicit ' ' Load the class library ' ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(CurrentPath() & "mod-app-logging.vbs").ReadAll ' ' Get The Current Program Path ' Function CurrentPath() CurrentPath = Replace(WScript.ScriptFullName, WScript.ScriptName,"") End Function ' ' Code to test the program ' Public Sub Test() ' Create the logging object Dim objLogs Set objLogs = New clsAppLogging ' Set file / app name objLogs.FileName = "MyApp.log" objLogs.AppName = "MyApp" ' Write to both app & event logs objLogs.Message = "This is a real error!" objLogs.Events = Event_Error objLogs.Write ' Write to just app log objLogs.Message = "Log action for audit purposes" objLogs.Events = Event_Information objLogs.Write End Sub ' ' Execute the code ' Test