At times it's useful to see what values variables hold, or offer some pause point before the code goes elsewhere before causing havoc. Its possible to write output to the terminal but this can get lost in copious forms of other outputs, besides, there's no pausing the script execution either.
The following proc creates a custom dialog which displays ad message along with the point in the calling script from which it was invoked.
## simple runtime debugging feedback dialog, alternative to console based gnocl::msg
# @param msg message to display
# @returns none
#
proc xxx::msg {txt} {
set frame [info frame -1]
append msg "Message:\n\n"
append msg "$txt\n\n\n"
append msg "Called from:\n\n"
append msg "Proc:\t[lindex [info level -1] 0]\n"
append msg "File:\t[file tail [dict get $frame file]]\n"
append msg "Line:\t[dict get $frame line]\n"
gnocl::dialog \
-type info \
-text $msg \
-title [lindex [info level 0] 0] \
-setSize 0.2
}
## simple runtime debugging feedback dialog, alternative to console based gnocl::msg
# @param msg message to display
# @returns none
#
proc xxx::msg {txt} {
set frame [info frame -1]
append msg "Message:\n\n"
append msg "$txt\n\n\n"
append msg "Called from:\n\n"
append msg "Proc:\t[lindex [info level -1] 0]\n"
append msg "File:\t[file tail [dict get $frame file]]\n"
append msg "Line:\t[dict get $frame line]\n"
gnocl::dialog \
-type info \
-text $msg \
-title [lindex [info level 0] 0] \
-setSize 0.2
}
Comments