2017-04-21 03:18:37 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\FullTextSearch\Tests\SolrReindexTest;
|
|
|
|
|
|
|
|
use Monolog\Handler\AbstractProcessingHandler;
|
2022-12-12 03:22:01 +01:00
|
|
|
use Monolog\LogRecord;
|
2017-04-21 03:18:37 +02:00
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logger for recording messages for later retrieval
|
|
|
|
*/
|
|
|
|
class SolrReindexTest_Handler extends AbstractProcessingHandler implements TestOnly
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Messages
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $messages = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all messages
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getMessages()
|
|
|
|
{
|
|
|
|
return $this->messages;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clear()
|
|
|
|
{
|
|
|
|
$this->messages = array();
|
|
|
|
}
|
|
|
|
|
2022-12-12 03:22:01 +01:00
|
|
|
protected function write(LogRecord $record): void
|
2017-04-21 03:18:37 +02:00
|
|
|
{
|
|
|
|
$this->messages[] = $record['message'];
|
|
|
|
}
|
|
|
|
}
|