Make WordPress Core

Changeset 41316


Ignore:
Timestamp:
08/25/2017 06:11:04 PM (8 years ago)
Author:
iandunn
Message:

Dashboard: Discontinue nonessential logging of Events API requests.

These log entries are only useful when troubleshooting unexpected results from the API, which is not common. The vast majority of users are better served by not having their logs cluttered with noise.

For the rare situations where troubleshooting is necessary, it can be achieved by a plugin (see #41217 for an example).

Props Howdy_McGee, dd32.
Fixes #41217.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-community-events.php

    r41189 r41316  
    9999        $response_body  = json_decode( wp_remote_retrieve_body( $response ), true );
    100100        $response_error = null;
    101         $debugging_info = compact( 'api_url', 'request_args', 'response_code', 'response_body' );
    102101
    103102        if ( is_wp_error( $response ) ) {
     
    117116
    118117        if ( is_wp_error( $response_error ) ) {
    119             $this->maybe_log_events_response( $response_error->get_error_message(), $debugging_info );
    120 
    121118            return $response_error;
    122119        } else {
     
    158155            $response_body = $this->format_event_data_time( $response_body );
    159156
    160             // Avoid bloating the log with all the event data, but keep the count.
    161             $debugging_info['response_body']['events'] = count( $debugging_info['response_body']['events'] ) . ' events trimmed.';
    162 
    163             $this->maybe_log_events_response( 'Valid response received', $debugging_info );
    164 
    165157            return $response_body;
    166158        }
     
    419411     * Logs responses to Events API requests.
    420412     *
    421      * All responses are logged when debugging, even if they're not WP_Errors.
    422      * Debugging info is still needed for "successful" responses, because
    423      * the API might have returned a different location than the one the user
    424      * intended to receive. In those cases, knowing the exact `request_url` is
    425      * critical.
    426      *
    427      * Errors are logged instead of being triggered, to avoid breaking the JSON
    428      * response when called from AJAX handlers and `display_errors` is enabled.
    429      *
    430      * @since 4.8.0
     413     * @since 4.8.0
     414     * @deprecated 4.9.0 Use a plugin instead. See #41217 for an example.
    431415     *
    432416     * @param string $message A description of what occurred.
     
    435419     */
    436420    protected function maybe_log_events_response( $message, $details ) {
     421        _deprecated_function( __METHOD__, '4.9.0' );
     422
    437423        if ( ! WP_DEBUG_LOG ) {
    438424            return;
Note: See TracChangeset for help on using the changeset viewer.