Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:cmdtrace}
h2. Name

*cmdtrace* — Control tcl command tracing

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*cmdtrace on* \[_level_]
*cmdtrace off* 
*cmdtrace maxblockcount* _count_ 

{panel}

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

h2. Arguments
*on* _level_ 
{indent}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. 
{indent}
*off* 
{indent}Disables command tracing.{indent} 

*maxblockcount* _count_ 
{indent}How many lines to keep in the command log window. The default value is 2000.{indent} 
 
h2. Examples
The following example show commands at level 1 and level 2. 

h3. Commands at different levels

{noformat:|borderWidth=1|bgColor=#eeeeee}
namespace eval myspace {
	variable x 1
}

proc myproc {} {
	puts hello
}

puts "I'm a toplevel command"
myproc
{noformat}

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. 

{noformat:|borderWidth=1|bgColor=#eeeeee}
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
{noformat}