audit - logging and debugging helper facility
Sample usage

Auditing library is a small piece of code that allows logging events, describing their level, dumping stack and many other things that can really be useful when debugging an application.

For now only a small demonstration is available:

# small audit example
package require audit::audit

audit::configure -level 9 -logfile audit.txt -datafile audit.aud

# just log that we're initializing
audit::audit someType 3 "Initializing application"

set var1 1
set var2(2) 1234

# log an error + contents of variables var1 and var2
audit::audit someType 1 "Error message" {var1 var2}

# log an error + some other information (as name-value pairs)
if {[catch {
    set fh [open /path/to/file.xml]
} err]} {
    audit::audit someType 1 "Cannot open file: $err" {} \
	errorInfo $::errorInfo errorCode $::errorCode
}


This will cause the following audit logfile to be created:
06-06-02 12:12:54.6660 | someType | 3 | 0 | Initializing application
09-06-02 12:12:54.6662 | someType | 1 | 0 | Error message
06-06-02 12:12:54.6664 | someType | 1 | 0 | Cannot open file:
    couldn't open "/path/to/file.xml": no such file or directory


Documentation can be found here.

© 2002-2006 Data Quest and
Wojciech Kocjan.
All rights reserverd.