Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
8 / 8 |
ClientLogHandler | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
8 / 8 |
handle | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
flush | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
<?php | |
namespace Shellbox; | |
use Monolog\Handler\AbstractHandler; | |
class ClientLogHandler extends AbstractHandler { | |
/** @var array */ | |
private $records = []; | |
public function handle( array $record ): bool { | |
$this->records[] = [ | |
'level' => $record['level'], | |
'message' => $record['message'], | |
'context' => $record['context'] | |
]; | |
return false; | |
} | |
/** | |
* Remove and return the accumulated log entries | |
* | |
* @return array | |
*/ | |
public function flush() { | |
$records = $this->records; | |
$this->records = []; | |
return $records; | |
} | |
} |