Skip to content

Commit

Permalink
Events relating to HTTP error codes (outbound requests) are now class…
Browse files Browse the repository at this point in the history
…ified according to their severity.
  • Loading branch information
Pierre Lannoy committed Sep 13, 2019
1 parent f08d7ed commit 2f75f34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 11 additions & 1 deletion includes/listeners/class-corelistener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 2f75f34

Please sign in to comment.