You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**logger** - The PSR-3 logger to use for logging.
58
-
-**logRequests** - By default the middleware is set to log every request and response. If you wish that to log only the requests and responses that you retrieve a status code above 4xx set this as false.
58
+
-**$onExceptionOnly** - By default the middleware is set to log every request and response. If you wish that to log only the requests and responses that you retrieve a status code above 4xx set this as true.
59
59
-**logStatistics** - If you set logStatistics as true and this as true then guzzle will also log statistics about the requests.
60
60
-**thresholds** - An array that you may use to change the thresholds of logging the responses.
61
61
@@ -66,7 +66,7 @@ You can set on each request options about your log.
66
66
```php
67
67
$client->get("/", [
68
68
'log' => [
69
-
'requests' => true,
69
+
'on_exception_only' => true,
70
70
'statistics' => true,
71
71
'error_threshold' => null,
72
72
'warning_threshold' => null,
@@ -81,8 +81,8 @@ $client->get("/", [
81
81
```
82
82
83
83
-``sensitive`` if you set this to true then the body of request/response will not be logged as it will be considered that it contains sensitive information.
84
-
-``requests`` Do not log anything unless if the request is above the threshold or inside the levels.
85
-
-``statistics`` if the requests variable is true and this is also true the logger will log statistics about the request
84
+
-``on_exception_only`` Do not log anything unless if the response status code is above the threshold.
85
+
-``statistics`` if the `on_exception_only` option/variable is true and this is also true the middleware will log statistics about the HTTP call.
86
86
-``levels`` set custom log levels for each response status code
Copy file name to clipboardExpand all lines: src/Middleware/LoggerMiddleware.php
+19-11Lines changed: 19 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ class LoggerMiddleware
19
19
/**
20
20
* @var bool Whether or not to log requests as they are made.
21
21
*/
22
-
private$logRequestOnExceptionOnly;
22
+
private$onExceptionOnly;
23
23
24
24
/**
25
25
* @var bool
@@ -50,18 +50,18 @@ class LoggerMiddleware
50
50
* Creates a callable middleware for logging requests and responses.
51
51
*
52
52
* @param LoggerInterface $logger
53
-
* @param bool $logRequestOnExceptionOnly
54
-
* @param bool $logStatistics
53
+
* @param bool $onExceptionOnly The request and the response will be logged only in cases there is an exception or if they status code exceeds the thresholds.
54
+
* @param bool $logStatistics If this is true an extra row will be added that will contain some HTTP statistics.
0 commit comments