darope@0: darope@0: darope@0: darope@0: darope@0:
darope@0:This was originally intended as a (more or less) complete example of a darope@0: Metamod plugin. It catches every call available to it (dll darope@0: routines both before and after the game, as well as engine functions both darope@0: before and after the engine). darope@0: darope@0:
Because it catches every routine, I figured I'd give it the ability to darope@0: log when given routines are called, so it became an "api tracing" plugin. darope@0: :) darope@0: darope@0:
This can actually be useful for tracking the operation of the HL darope@0: engine, as well as that of a particular HL game mod. darope@0: darope@0:
It recognizes the following server cvars: darope@0: darope@0:
darope@0: // Tracing debug levels; higher values log increasingly frequent routines. darope@0: // Currently 0-50. See "api_info.cpp" for the debug levels of various darope@0: // functions. darope@0: darope@0: // Trace level for dllapi routines. darope@0: trace_dllapi darope@0: darope@0: // Trace level for "new" dllapi routines. darope@0: trace_newapi darope@0: darope@0: // Trace level for engine functions. darope@0: trace_engine darope@0: darope@0: // Enable unlimited trace logging. By default (as of v1.06), it only darope@0: // logs _one_ trace message per second, to keep from overwhelming the darope@0: // server. Set to "1" to enable unlimited logging. (Default "0") darope@0: trace_unlimit darope@0: darope@0: // General debug level, independent of trace levels. Not currently used. darope@0: trace_debug darope@0: darope@0:darope@0: darope@0:
and the following server commands: darope@0: darope@0:
darope@0: // Enable tracing of a given routine, independent of "trace_*" level. darope@0: // See the list of routine names in "api_info.cpp". Case is insignificant. darope@0: trace set <APIroutine> darope@0: darope@0: // Disable tracing of a given routine, iff previously enabled with "trace". darope@0: // Doesn't affect routines being logged via "trace_*" level. darope@0: trace unset <APIroutine> darope@0: darope@0: // Show the routines being traced. darope@0: trace show darope@0: darope@0: // List the various routines that can be traced. darope@0: trace list dllapi darope@0: trace list newapi darope@0: trace list engine darope@0: trace list all darope@0: darope@0: // Prints out version/date/etc. darope@0: trace version darope@0:darope@0: darope@0:
Note the information it logs on each routine invocation is, at the darope@0: moment, relatively minimal. I included information that seemed obvious darope@0: (args for a ClientCommand, etc), and I've added info for other darope@0: routines as I've come across a need. Most routines I still know too little darope@0: about to log any particular information (CreateBaseline, etc). darope@0: Feel free to add information that you're interested in to the log messages darope@0: in the routines; the examples should be pretty self-explanatory. I'd be darope@0: interested in knowing as well, for adding it to the distribution code. darope@0: darope@0:
darope@0: