Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function logRequest(Request $request) |
||
13 | { |
||
14 | $method = strtoupper($request->getMethod()); |
||
15 | |||
16 | $uri = $request->getPathInfo(); |
||
17 | |||
18 | $bodyAsJson = json_encode($request->except(config('http-logger.except'))); |
||
19 | |||
20 | $headersAsJson = json_encode($request->headers->all()); |
||
21 | |||
22 | $files = (new Collection(iterator_to_array($request->files))) |
||
23 | ->map([$this, 'flatFiles']) |
||
24 | ->flatten() |
||
25 | ->implode(','); |
||
26 | |||
27 | $message = "{$method} {$uri} - Body: {$bodyAsJson} - Headers: {$headersAsJson} - Files: ".$files; |
||
28 | |||
29 | Log::info($message); |
||
30 | } |
||
31 | |||
44 |