Quick Debugging Feedback

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 procedure 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.

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

Is there any way to introspectively determine where; in the calling procedure; _DEBUG_ was called?