Version 2 of Quick Debugging Feedback

Updated 2009-04-27 17:04:23 by WJG

WJG (27-Apr-09) We must all use the Tcl 'puts' command to write debugging feedback to the console. As I like to know which proceedure produced what message, I thought that I'd formalise the process with a few lines of code rather than typing in too much in the script hence this simple inclusion to my script main header. I'm sure there's a better way of doing things but this only took me five minutes to throw together.

set VERBOSE true

if { $VERBOSE } {
    # print debug message and the proceedure from which it was called
    proc _DEBUG_ {str} { if {$::VERBOSE} { puts "DEBUG:\t[lindex [info level 1] 0]\t MSG: $str" } }
}

enter categories here