From: Michael Wallner Date: Wed, 20 May 2015 13:29:04 +0000 (+0200) Subject: add rate limits to logs X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b9ea42b0b88f4976327ed03a1e4abb9b34248b7a;p=pharext%2Fpharext.org add rate limits to logs --- diff --git a/app/Github/ClientObserver.php b/app/Github/ClientObserver.php index 89e01d8..036f303 100644 --- a/app/Github/ClientObserver.php +++ b/app/Github/ClientObserver.php @@ -27,7 +27,12 @@ class ClientObserver implements SplObserver break; case "finished": $response = $client->getResponse($request); - $message = sprintf("API-Shot: finished [%d] %s %s", $response->getResponseCode(), $request->getRequestMethod(), $request->getRequestUrl()); + $message = sprintf("API-Shot: finished [%d] (rate-limit:%d/%d) %s %s", + $response->getResponseCode(), + $response->getHeader("X-RateLimit-Remaining"), + $response->getHeader("X-RateLimit-Limit"), + $request->getRequestMethod(), + $request->getRequestUrl()); if ($response->getResponseCode() >= 400 || $response->getTransferInfo("error")) { $this->logger->error($message, (array) $response->getTransferInfo()); } else {