Ns register trace

From AOLserver Wiki
Revision as of 06:11, 28 October 2009 by Akhassin (talk | contribs)
Jump to navigation Jump to search

Man page: http://aolserver.com/man/4.0/tcl/ns_filter.html


NAME

ns_register_trace - Register a void trace filter for a method/URL combination

SYNOPSIS

ns_register_trace method urlPattern script ?arg?

DESCRIPTION

ns_register_trace registers a Tcl script as a trace for the specified method/URL combination. After the server handles the request for the specified method on an URL that matches the URLpattern, IF no error occurred, it calls the trace script with the connection id and any arguments (args) specified. The URLpattern can contain standard string-matching characters. For example, these are valid URLpatterns:
/employees/*.tcl /accounts/*/out 
Note ns_register_trace is similar to ns_register_proc except that the pattern-matching for the URL is performed differently. With ns_register_proc, the specified URL is used to match that URL and any URL below it in the hierarchy. Wildcards such as "*" are meaningful only for the final part of the URL, such as /scripts/*.tcl. With ns_register_trace, the URLpattern is used to match URLs as a string with standard string-matching characters. ns_register_proc results in a single match, whereas multiple ns_register_trace’s can be matched and will be called.
This command differs from ns_register_filter trace in that traces registered with this command only run if the request (or a trace filter registered with ns_register_filter trace) did not result in an error. In, addition, the return value of the last trace registered with this command is ignored, hence the name void trace filter.
If the registered script returns:
  • TCL_OK (using: return "filter_ok") - The server will continue to the next void trace filter.
  • TCL_BREAK (using: return "filter_break") - The rest of the void trace filters are ignored.
  • TCL_RETURN (using: return "filter_break") - The rest of the trace filters are ignored. No effect on subsequent C-level ServerTrace (i.e. access logging) execution.

SEE ALSO

ns_register_filter