1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
namespace App\Support;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
class Logger implements LoggerInterface
{
public static function logRequestToFile(Request $request): void
{
$basePath = dirname(dirname(__DIR__)) . "/.cache/log/" . str_replace("/", "_", $request->getPathInfo());
file_put_contents(
$basePath . "-body.json",
json_encode(json_decode($request->getContent()), JSON_PRETTY_PRINT)
);
file_put_contents(
$basePath . "-query.json",
json_encode($request->query->all(), JSON_PRETTY_PRINT)
);
file_put_contents(
$basePath . "-header.json",
json_encode($request->headers->all(), JSON_PRETTY_PRINT)
);
}
public function emergency($message, array $context = []): void
{
}
public function alert($message, array $context = []): void
{
}
public function critical($message, array $context = []): void
{
}
public function error($message, array $context = []): void
{
}
public function warning($message, array $context = []): void
{
}
public function notice($message, array $context = []): void
{
}
public function info($message, array $context = []): void
{
}
public function debug($message, array $context = []): void
{
}
public function log($level, $message, array $context = []): void
{
}
}
|