Skip to content

Commit

Permalink
Add a flag for disabling logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Sep 13, 2024
1 parent b952d48 commit c80bdf6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/HttpHandler/HttpHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ class HttpHandlerFactory
* Builds out a default http handler for the installed version of guzzle.
*
* @param ClientInterface $client
* @param LoggerInterface $logger
* @param bool $loggerDisabled
* @return Guzzle6HttpHandler|Guzzle7HttpHandler
* @throws \Exception
*/
public static function build(ClientInterface $client = null, LoggerInterface $logger = null)
public static function build(
ClientInterface $client = null,
LoggerInterface $logger = null,
bool $loggerDisabled = false)
{
if (is_null($client)) {
$stack = null;
Expand All @@ -47,7 +52,10 @@ public static function build(ClientInterface $client = null, LoggerInterface $lo
$client = new Client(['handler' => $stack]);
}

$logger = $logger ?? ApplicationDefaultCredentials::getDefaultLogger();
if (!$loggerDisabled) {
$logger = $logger ?? ApplicationDefaultCredentials::getDefaultLogger();
}


$version = null;
if (defined('GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
Expand Down

0 comments on commit c80bdf6

Please sign in to comment.