Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit c68dad5

Browse files
committed
fix for 5.4
1 parent 3c5aa41 commit c68dad5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,8 @@ $requester->addLogger($log);
136136

137137
// request and response logged to file
138138
$requester->url('example.com')->get();
139+
140+
// Use the second param to update the format
141+
$requester = new Requester(new GuzzleClient());
142+
$requester->addLogger($log, 'DEBUG');
139143
```

src/Requester.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace PulkitJalan\Requester;
44

55
use GuzzleHttp\Client as GuzzleClient;
6-
use GuzzleHttp\Subscriber\Log\Formatter;
76
use GuzzleHttp\Subscriber\Log\LogSubscriber;
87
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;
98
use PulkitJalan\Requester\Exceptions\InvalidUrlException;
@@ -114,8 +113,8 @@ public function getGuzzleClient()
114113
*/
115114
public function addLogger($logger, $format = 'CLF')
116115
{
117-
if (defined(Formatter::class.'::'.$format)) {
118-
$format = constant(Formatter::class.'::'.$format);
116+
if (defined('GuzzleHttp\Subscriber\Log\Formatter::'.$format)) {
117+
$format = constant('GuzzleHttp\Subscriber\Log\Formatter::'.$format);
119118
}
120119

121120
$subscriber = new LogSubscriber($logger, $format);

0 commit comments

Comments
 (0)