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.

Built from https://develop.svn.wordpress.org/trunk@41316


git-svn-id: http://core.svn.wordpress.org/trunk@41147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
iandunn 2017-08-25 18:12:44 +00:00
parent bbb8d48086
commit 476377f64d
2 changed files with 4 additions and 18 deletions

View File

@ -98,7 +98,6 @@ class WP_Community_Events {
$response_code = wp_remote_retrieve_response_code( $response );
$response_body = json_decode( wp_remote_retrieve_body( $response ), true );
$response_error = null;
$debugging_info = compact( 'api_url', 'request_args', 'response_code', 'response_body' );
if ( is_wp_error( $response ) ) {
$response_error = $response;
@ -116,8 +115,6 @@ class WP_Community_Events {
}
if ( is_wp_error( $response_error ) ) {
$this->maybe_log_events_response( $response_error->get_error_message(), $debugging_info );
return $response_error;
} else {
$expiration = false;
@ -157,11 +154,6 @@ class WP_Community_Events {
$response_body = $this->trim_events( $response_body );
$response_body = $this->format_event_data_time( $response_body );
// Avoid bloating the log with all the event data, but keep the count.
$debugging_info['response_body']['events'] = count( $debugging_info['response_body']['events'] ) . ' events trimmed.';
$this->maybe_log_events_response( 'Valid response received', $debugging_info );
return $response_body;
}
}
@ -418,22 +410,16 @@ class WP_Community_Events {
/**
* Logs responses to Events API requests.
*
* All responses are logged when debugging, even if they're not WP_Errors.
* Debugging info is still needed for "successful" responses, because
* the API might have returned a different location than the one the user
* intended to receive. In those cases, knowing the exact `request_url` is
* critical.
*
* Errors are logged instead of being triggered, to avoid breaking the JSON
* response when called from AJAX handlers and `display_errors` is enabled.
*
* @since 4.8.0
* @deprecated 4.9.0 Use a plugin instead. See #41217 for an example.
*
* @param string $message A description of what occurred.
* @param array $details Details that provide more context for the
* log entry.
*/
protected function maybe_log_events_response( $message, $details ) {
_deprecated_function( __METHOD__, '4.9.0' );
if ( ! WP_DEBUG_LOG ) {
return;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41315';
$wp_version = '4.9-alpha-41316';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.