Name
cmdtrace — Control tcl command tracing
Syntax
cmdtrace on [level]
cmdtrace off
cmdtrace maxblockcount count
Description
The cmdtrace turns on or off tcl command tracing. Traced commands are visible in Geocaps command log window. Enabling command tracing will reduce Tcl performance somewhat, although built-in C++ algorithms are not affected. Don't trace more levels than you need if this is a concern.
You may wish to trace commands only at a given level. A level refers to the level of nested scope in which a command is executed. A toplevel command, executed outside any proc and namespaces, belong to level 1. Commands called from a level 1 command will have level 2, etc.
Arguments
on level
Enables command tracing. The default level is 0, meaning all levels are traced. If you specify a level only commands lower or equal to that level will be traced.
off
Disables command tracing.
maxblockcount count
How many lines to keep in the command log window. The default value is 2000.
Examples
The following example show commands at level 1 and level 2.
Commands at different levels
namespace eval myspace { variable x 1 } proc myproc {} { puts hello } puts "I'm a toplevel command" myproc
Executing the previous example yields the following output in Geocaps command log. The left-most number indicates the level. Note that proc and namespace are commands like any other in Tcl.
1:namespace eval myspace { variable x 1 } 2:variable x 1 1:proc myproc {} { puts hello } 1:puts "I'm a toplevel command" 1:myproc 2:puts hello