1 | <?php |
||
9 | class PsrSqlLogger implements SQLLogger |
||
10 | { |
||
11 | /** @var callable */ |
||
12 | private $logger; |
||
13 | |||
14 | /** @var float */ |
||
15 | private $start; |
||
16 | |||
17 | /** @var string */ |
||
18 | private $queryId; |
||
19 | |||
20 | /** |
||
21 | * PsrSqlLogger constructor. |
||
22 | * @param LoggerInterface $logger |
||
23 | * @param string $level |
||
24 | */ |
||
25 | 6 | public function __construct(LoggerInterface $logger, $level = LogLevel::INFO) |
|
26 | { |
||
27 | 6 | $callable = [$logger, $level]; |
|
28 | |||
29 | 6 | if (!\is_callable($callable)) { |
|
30 | 1 | throw new \InvalidArgumentException(sprintf( |
|
31 | 1 | '%s::%s" is not callable', |
|
32 | 1 | LoggerInterface::class, |
|
33 | $level |
||
34 | )); |
||
35 | } |
||
36 | |||
37 | 6 | $this->logger = $callable; |
|
38 | 6 | } |
|
39 | |||
40 | 5 | public function startQuery($sql, array $params = null, array $types = null) |
|
53 | |||
54 | 5 | protected function getStartQueryContext($sql, array $params = null, array $types = null) |
|
61 | |||
62 | 3 | public function stopQuery() |
|
73 | } |
||
74 |