-
-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathTestLogger.php
More file actions
38 lines (32 loc) · 716 Bytes
/
TestLogger.php
File metadata and controls
38 lines (32 loc) · 716 Bytes
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
<?php
namespace PhpBench\Tests\Util;
use Psr\Log\AbstractLogger;
/**
* Used for testing purposes.
*
* It records all records and gives you access to them for verification.
*
*/
class TestLogger extends AbstractLogger
{
/** @var mixed[] */
public array $records = [];
public function reset(): void
{
$this->records = [];
}
/**
* @param mixed $level
* @param string $message
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
{
$record = [
'level' => $level,
'message' => $message,
'context' => $context,
];
$this->records[] = $record;
}
}