File tree 3 files changed +31
-2
lines changed
src/Symfony/Component/HttpClient
3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1
1
CHANGELOG
2
2
=========
3
3
4
+ 5.1.0
5
+ -----
6
+
7
+ * added ` LoggerAwareInterface ` to ` ScopingHttpClient ` and ` TraceableHttpClient `
8
+
4
9
4.4.0
5
10
-----
6
11
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \HttpClient ;
13
13
14
+ use Psr \Log \LoggerAwareInterface ;
15
+ use Psr \Log \LoggerInterface ;
14
16
use Symfony \Component \HttpClient \Exception \InvalidArgumentException ;
15
17
use Symfony \Contracts \HttpClient \HttpClientInterface ;
16
18
use Symfony \Contracts \HttpClient \ResponseInterface ;
22
24
*
23
25
* @author Anthony Martin <anthony.martin@sensiolabs.com>
24
26
*/
25
- class ScopingHttpClient implements HttpClientInterface, ResetInterface
27
+ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface
26
28
{
27
29
use HttpClientTrait;
28
30
@@ -98,4 +100,14 @@ public function reset()
98
100
$ this ->client ->reset ();
99
101
}
100
102
}
103
+
104
+ /**
105
+ * {@inheritdoc}
106
+ */
107
+ public function setLogger (LoggerInterface $ logger )
108
+ {
109
+ if ($ this ->client instanceof LoggerAwareInterface) {
110
+ $ this ->client ->setLogger ($ logger );
111
+ }
112
+ }
101
113
}
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \HttpClient ;
13
13
14
+ use Psr \Log \LoggerAwareInterface ;
15
+ use Psr \Log \LoggerInterface ;
14
16
use Symfony \Contracts \HttpClient \HttpClientInterface ;
15
17
use Symfony \Contracts \HttpClient \ResponseInterface ;
16
18
use Symfony \Contracts \HttpClient \ResponseStreamInterface ;
19
21
/**
20
22
* @author Jérémy Romey <jeremy@free-agent.fr>
21
23
*/
22
- final class TraceableHttpClient implements HttpClientInterface, ResetInterface
24
+ final class TraceableHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface
23
25
{
24
26
private $ client ;
25
27
private $ tracedRequests = [];
@@ -75,4 +77,14 @@ public function reset()
75
77
76
78
$ this ->tracedRequests = [];
77
79
}
80
+
81
+ /**
82
+ * {@inheritdoc}
83
+ */
84
+ public function setLogger (LoggerInterface $ logger )
85
+ {
86
+ if ($ this ->client instanceof LoggerAwareInterface) {
87
+ $ this ->client ->setLogger ($ logger );
88
+ }
89
+ }
78
90
}
You can’t perform that action at this time.
0 commit comments