Difference between revisions of "Ns register trace"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
'''SYNOPSIS''' | '''SYNOPSIS''' | ||
− | : '''ns_register_trace''' ''method urlPattern | + | : '''ns_register_trace''' ''method urlPattern procName ?args?'' |
'''DESCRIPTION''' | '''DESCRIPTION''' | ||
− | : ns_register_trace registers a Tcl | + | : ns_register_trace registers a Tcl procedure 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 procedure 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 | /employees/*.tcl /accounts/*/out | ||
− | : | + | : The procedure to be registered |
− | : 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 (including a thrown error) of any trace registered with this command is ignored, hence the name ''void trace filter''. Because the return value is ignored it is not possible for a trace registered with this command to prevent execution of the next trace or the subsequent C-level ServerTraces (i.e. access logging). | + | : 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 for ns_register_proc 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 (having a trace filter registered with ns_register_filter trace return anything other than "filter_ok", "filter_return", or "filter_break" is equivalent to resulting in an error). | ||
+ | |||
+ | : In addition, the return value (including a thrown error) of any trace registered with this command is ignored, hence the name ''void trace filter''. Because the return value is ignored it is not possible for a trace registered with this command to prevent execution of the next trace or the subsequent C-level ServerTraces (i.e. access logging). | ||
'''SEE ALSO''' | '''SEE ALSO''' |
Revision as of 06:42, 28 October 2009
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 procName ?args?
DESCRIPTION
- ns_register_trace registers a Tcl procedure 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 procedure 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
- The procedure to be registered
- 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 for ns_register_proc 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 (having a trace filter registered with ns_register_filter trace return anything other than "filter_ok", "filter_return", or "filter_break" is equivalent to resulting in an error).
- In addition, the return value (including a thrown error) of any trace registered with this command is ignored, hence the name void trace filter. Because the return value is ignored it is not possible for a trace registered with this command to prevent execution of the next trace or the subsequent C-level ServerTraces (i.e. access logging).
SEE ALSO