A. bw_trace2(), bw_trace(), and bw_backtrace().
bw_trace2()
Easy to use tracing. When invoked without parameters it will report the values of the parameters passed to its calling function. e.g.You appear to be a bot. Output may be restricted
function my_func( $param1, $param2=null ) { bw_trace2(); }This will produce a trace record for my_func, showing the parameter values in an array.
my_func.php(4:0) my_func(1) 1 2015-07-28T11:07:54+00:00 0.000008 0.000008 cf! F=21 2 Array ( [0] => Trace example [1] => 4445 )When parameters are passed to bw_trace2() it traces these.
function my_func2() {
$var = "Trace me";
bw_trace2( $var );
$arr = array( "Trace me", "array" );
bw_trace2( $arr, "array", false );
}
my_func.php(9:0) my_func2(1) 2 2015-07-28T11:29:12+00:00 0.001089 0.001081 cf! F=21 0 my_func.php(9:0) my_func2(2) 3 2015-07-28T11:29:12+00:00 0.001660 0.000571 cf! F=21 Trace me my_func.php(11:0) my_func2(3) 4 2015-07-28T11:29:12+00:00 0.002249 0.000589 cf! F=21 array Array ( [0] => Trace me [1] => array )If you don’t pass a label, parameters which may be null or 0 are not traced. When this happens the absence of the trace record indicates the value is null. This is useful when you have more than one call to bw_trace2() in a function. If you pass
false
as the third parameter, then the parameters to the function that invokes bw_trace2() are not reproduced; you get fewer trace records.
bw_trace()
This is a lower level function than bw_trace2(). You need to pass it more parameters. Use bw_trace2() in preference to bw_trace().bw_backtrace()
This shows the context in which the current code has been invoked.You appear to be a bot. Output may be restricted
function my_func_gets_called_where() { bw_backtrace(); }Example
0. bw_lazy_backtrace libs\bwtrace.php:72 0 1. bw_backtrace my_func.php:15 0 2. my_func_gets_called_where my_func.php:19 0 3. require_once(my_func.php) oik-batch\oik-batch.php:313 1 4. oik_batch_run_script(my_func.php) oik-batch\oik-batch.php:350 1 5. oik_batch_run oik-batch\oik-batch.php:274 0 6. oik_batch_loaded oik-batch\oik-batch.php:356 0
Notes
- These are dormant APIs provided by the oik base and oik-lib plugins
- Each API is a wrapper to a lazy function
- The oik-bwtrace plugin implements the lazy functions
- For implementation details see
- In these examples most of the path to the files has been stripped