diff --git a/CHANGELOG.md b/CHANGELOG.md index 63875a5d..ca6bb166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - Plugin activation/deactivation give the full plugin name (instead of its slug). - Events regarding "options" and "transients" now differentiate site/network operations. +- Events relating to HTTP error codes (outbound requests) are now classified according to their severity. - The word "blog" has been replaced by "site" in events messages. - Some help strings have been modified to be more clear. - Lower severity of serialized json messages (triggered by `wp_die` handler) from criticial to debug. diff --git a/includes/listeners/class-corelistener.php b/includes/listeners/class-corelistener.php index e5eebe1b..441c0902 100644 --- a/includes/listeners/class-corelistener.php +++ b/includes/listeners/class-corelistener.php @@ -1085,7 +1085,17 @@ public function http_api_debug( $response, $context, $class, $request, $url ) { $message .= $verb . ' ' . $url; } if ( $error ) { - $this->logger->error( $message, $code ); + if ( $code >= 500 ) { + $this->logger->error( $message, $code ); + } elseif ( $code >= 400 ) { + $this->logger->warning( $message, $code ); + } elseif ( $code >= 200 ) { + $this->logger->notice( $message, $code ); + } elseif ( $code >= 100 ) { + $this->logger->info( $message, $code ); + } else { + $this->logger->critical( $message, $code ); + } } else { $this->logger->debug( $message, $code ); }