Index: openacs-4/packages/acs-tcl/tcl/tcltrace-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcltrace-init.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-tcl/tcl/tcltrace-init.tcl 7 Aug 2017 23:48:00 -0000 1.2 +++ openacs-4/packages/acs-tcl/tcl/tcltrace-init.tcl 12 Dec 2017 10:27:11 -0000 1.3 @@ -24,13 +24,26 @@ # # Optionally add more traces here # +# simple traces +# set traced_cmds {} #set traced_cmds {::nsv_get} #set traced_cmds {::ns_setcookie ::ns_getcookie ::ns_deletecookie} foreach cmd $traced_cmds { append trace "\ntrace add execution $cmd enter {::tcltrace::before}" } +set traced_cmds {} +# +# traces with context +# +#set traced_cmds {::ns_return} +foreach cmd $traced_cmds { + append trace "\ntrace add execution $cmd enter {::tcltrace::before -details}" +} +set traced_cmds {} + + if {$trace ne ""} { ns_ictl trace create $trace } Index: openacs-4/packages/acs-tcl/tcl/tcltrace-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcltrace-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/tcltrace-procs.tcl 7 Aug 2017 23:48:00 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/tcltrace-procs.tcl 12 Dec 2017 10:27:11 -0000 1.4 @@ -73,10 +73,22 @@ } } - ad_proc -private before { cmd op } { - Simple trace proc for arbitraty commands. simply reports traces to error.log. + ad_proc -private before { + {-details:boolean false} + cmd + op } { - ns_log notice "trace: $cmd" + + Generic trace proc for arbitraty commands. Simply reports + calls to function (optionally with full context) to the error.log. + + @param details when set, use ad_log for reporting with full context + @param cmd the full command as executed by Tcl + @param op the trace operation + + } { + set cmd [expr {$details_p ? "ad_log" : "ns_log"}] + $cmd notice "trace: $cmd" } }