Closed bobbingwide closed 4 years ago
With regards to tracing to separate files.
REST_REQUEST is not defined until the end of processing for parse_request
.
This is well after trace has started.
We could implement some code to pre-detect a REST request, by looking at $_SERVER['REQUEST_URI'],
taking into account sub-directory installs,
The only thing we'll do differently at this stage is to start tracing to the 'rest' set of trace files instead of the normal set.
At the end of REST processing, the filter rest_pre_echo_response
allows us to see what's being returned to the client.
If rest tracing is enabled we can hook into this and simply call bw_trace2().
REST API requests are similar to AJAX requests.
When, for any reason, oik-bwtrace fails to open the trace output file Warning message is produced from fopen(). The documentation suggests that it's OK to suppress this warning with a preceding
@
. We should do this regardless of the type of request. I'll raise a separate issue.It would be nice if REST requests could be traced to separate files. This depends on how early in the processing the REST_REQUEST constant is set to true. define( 'REST_REQUEST', true );