Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

six demon bag

Wind, fire, all that kind of thing!

2011-03-13

A Logger Class for VBScript

I got tired of having to re-implement logging routines for my VBScripts on a regular basis, so I wrote a logger class that serves as an abstraction layer for logging to interactive console/desktop, files or eventlog. Now I just instantiate a new logger, define the logging facilities (default is console/desktop for interactive, eventlog for non-interactive execution), and can log away with the same set of methods, regardless of log target. See API documentation for details.


If you want to use the logger class, either copy/paste the code to your script or import the class file with this neat procedure.

Thanks to Alex and Rico for their valuable input on the class interface.

Download

Version 2.0 (2011-03-13; changes the class name from LoggerClass to CLogger; adds another global method for message formatting with decimal instead of hexadecimal error numbers; removes global constants to avoid potential conflicts with other imported code)

Version 1.2 (2010-09-24; fixes a bug in error logging to eventlog and adds a global method for standard error message formatting)

Version 1.1 (2010-07-19; include API documentation)

Version 1.0 (2010-06-06; initial release)

Posted 22:10 [permalink]