doc/html/trace.html
author Scott Ehlert <ds@alliedmods.net>
Thu Sep 26 22:57:05 2013 -0500 (2013-09-26)
changeset 286 202d9c3207a2
parent 0 d15304fcb7a7
permissions -rw-r--r--
Fixed warning when building stub_mm plugin.
     1 <!-- vi: set ts=4 sw=4 : -->
     2 <!-- vim: set tw=75 : -->
     3 
     4 <HTML>
     5 <head>
     6 <title>Metamod TraceAPI Plugin</title>
     7 </head>
     8 <body>
     9 
    10 <h1>TraceAPI plugin
    11 </h1>
    12 
    13 <p> This was originally intended as a (more or less) complete example of a
    14 Metamod plugin.  It catches <b><i>every</i></b> call available to it (dll
    15 routines both before and after the game, as well as engine functions both
    16 before and after the engine).
    17 
    18 <p> Because it catches every routine, I figured I'd give it the ability to
    19 log when given routines are called, so it became an "api tracing" plugin.
    20 :)
    21 
    22 <p> This can actually be useful for tracking the operation of the HL
    23 engine, as well as that of a particular HL game mod.
    24 
    25 <p> It recognizes the following server cvars:
    26 
    27 <p><pre>
    28    // Tracing debug levels; higher values log increasingly frequent routines.
    29    // Currently 0-50.  See "api_info.cpp" for the debug levels of various
    30    // functions.
    31 
    32    // Trace level for dllapi routines.
    33    trace_dllapi
    34 
    35    // Trace level for "new" dllapi routines.
    36    trace_newapi
    37 
    38    // Trace level for engine functions.
    39    trace_engine
    40 
    41    // Enable unlimited trace logging.  By default (as of v1.06), it only
    42    // logs _one_ trace message per second, to keep from overwhelming the
    43    // server.  Set to "1" to enable unlimited logging.  (Default "0")
    44    trace_unlimit
    45 
    46    // General debug level, independent of trace levels.  Not currently used.
    47    trace_debug
    48 
    49 </pre>
    50 
    51 <p> and the following server commands:
    52 
    53 <p><pre>
    54    // Enable tracing of a given routine, independent of "trace_*" level.
    55    // See the list of routine names in "api_info.cpp".  Case is insignificant.
    56    trace set &lt;APIroutine&gt;
    57 
    58    // Disable tracing of a given routine, iff previously enabled with "trace".
    59    // Doesn't affect routines being logged via "trace_*" level.
    60    trace unset &lt;APIroutine&gt;
    61 
    62    // Show the routines being traced.
    63    trace show
    64 
    65    // List the various routines that can be traced.
    66    trace list dllapi
    67    trace list newapi
    68    trace list engine
    69    trace list all
    70 
    71    // Prints out version/date/etc.
    72    trace version
    73 </pre>
    74 
    75 <p> Note the information it logs on each routine invocation is, at the
    76 moment, relatively minimal.  I included information that seemed obvious
    77 (args for a <tt>ClientCommand</tt>, etc), and I've added info for other
    78 routines as I've come across a need.  Most routines I still know too little
    79 about to log any particular information (<tt>CreateBaseline</tt>, etc).
    80 Feel free to add information that you're interested in to the log messages
    81 in the routines; the examples should be pretty self-explanatory.  I'd be
    82 interested in knowing as well, for adding it to the distribution code.
    83 
    84 <p>
    85 <hr>
    86 
    87 </body>
    88 </HTML>