mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-09 14:46:46 +02:00
Rename logFormatter to batchFormatter, refs #203
This commit is contained in:
@@ -47,7 +47,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* @var LineFormatter The formatter to use for the logs generated via handleBatch()
|
* @var LineFormatter The formatter to use for the logs generated via handleBatch()
|
||||||
*/
|
*/
|
||||||
protected $logFormatter;
|
protected $batchFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Raven_Client $ravenClient
|
* @param Raven_Client $ravenClient
|
||||||
@@ -93,7 +93,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($logs) {
|
if ($logs) {
|
||||||
$record['context']['logs'] = (string) $this->getLogFormatter()->formatBatch($logs);
|
$record['context']['logs'] = (string) $this->getBatchFormatter()->formatBatch($logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->handle($record);
|
$this->handle($record);
|
||||||
@@ -104,9 +104,9 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
*
|
*
|
||||||
* @param FormatterInterface $formatter
|
* @param FormatterInterface $formatter
|
||||||
*/
|
*/
|
||||||
public function setLogFormatter(FormatterInterface $formatter)
|
public function setBatchFormatter(FormatterInterface $formatter)
|
||||||
{
|
{
|
||||||
$this->logFormatter = $formatter;
|
$this->batchFormatter = $formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,13 +114,13 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
*
|
*
|
||||||
* @return FormatterInterface
|
* @return FormatterInterface
|
||||||
*/
|
*/
|
||||||
public function getLogFormatter()
|
public function getBatchFormatter()
|
||||||
{
|
{
|
||||||
if (!$this->logFormatter) {
|
if (!$this->batchFormatter) {
|
||||||
$this->logFormatter = $this->getDefaultLogFormatter();
|
$this->batchFormatter = $this->getDefaultBatchFormatter();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->logFormatter;
|
return $this->batchFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +159,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
*
|
*
|
||||||
* @return FormatterInterface
|
* @return FormatterInterface
|
||||||
*/
|
*/
|
||||||
protected function getDefaultLogFormatter()
|
protected function getDefaultBatchFormatter()
|
||||||
{
|
{
|
||||||
return new LineFormatter();
|
return new LineFormatter();
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ class RavenHandlerTest extends TestCase
|
|||||||
$formatter->expects($this->once())->method('format');
|
$formatter->expects($this->once())->method('format');
|
||||||
|
|
||||||
$handler = $this->getHandler($this->getRavenClient());
|
$handler = $this->getHandler($this->getRavenClient());
|
||||||
$handler->setLogFormatter($logFormatter);
|
$handler->setBatchFormatter($logFormatter);
|
||||||
$handler->setFormatter($formatter);
|
$handler->setFormatter($formatter);
|
||||||
$handler->handleBatch($records);
|
$handler->handleBatch($records);
|
||||||
}
|
}
|
||||||
@@ -119,13 +119,13 @@ class RavenHandlerTest extends TestCase
|
|||||||
$handler->handleBatch($records);
|
$handler->handleBatch($records);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSetLogFormatter()
|
public function testGetSetBatchFormatter()
|
||||||
{
|
{
|
||||||
$ravenClient = $this->getRavenClient();
|
$ravenClient = $this->getRavenClient();
|
||||||
$handler = $this->getHandler($ravenClient);
|
$handler = $this->getHandler($ravenClient);
|
||||||
|
|
||||||
$handler->setLogFormatter($formatter = new LineFormatter());
|
$handler->setBatchFormatter($formatter = new LineFormatter());
|
||||||
$this->assertSame($formatter, $handler->getLogFormatter());
|
$this->assertSame($formatter, $handler->getBatchFormatter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function methodThatThrowsAnException()
|
private function methodThatThrowsAnException()
|
||||||
|
Reference in New Issue
Block a user