Skip to content

Instantly share code, notes, and snippets.

@tayhimself
Created June 6, 2017 19:54
Show Gist options
  • Save tayhimself/7f4713c3f207cdd2ba3d771c85cbf5dc to your computer and use it in GitHub Desktop.
Save tayhimself/7f4713c3f207cdd2ba3d771c85cbf5dc to your computer and use it in GitHub Desktop.
$monologHandler = new Monolog\Logger(
'Logger',
array(
new Monolog\Handler\StreamHandler('/tmp/log.txt', Monolog\Logger::DEBUG)
)
);
$stack = GuzzleHttp\HandlerStack::create();
$stack->push(
GuzzleHttp\Middleware::log(
$monologHandler,
new GuzzleHttp\MessageFormatter('{req_body} - {res_body}')
)
);
$guzzleClient = new \GuzzleHttp\Client(
array('handler' => $stack)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment