mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 06:06:40 +02:00
Fixing tests and CS, refs #468
This commit is contained in:
@@ -34,7 +34,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format (array $record)
|
||||
public function format(array $record)
|
||||
{
|
||||
return $this->formatArray($record);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function formatBatch (array $records)
|
||||
public function formatBatch(array $records)
|
||||
{
|
||||
foreach ($records as $key => $record) {
|
||||
$records[$key] = $this->format($record);
|
||||
@@ -51,7 +51,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
return $records;
|
||||
}
|
||||
|
||||
protected function formatArray (array $record, $nestingLevel = 0)
|
||||
protected function formatArray(array $record, $nestingLevel = 0)
|
||||
{
|
||||
if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
|
||||
foreach ($record as $name => $value) {
|
||||
@@ -72,14 +72,15 @@ class MongoDBFormatter implements FormatterInterface
|
||||
return $record;
|
||||
}
|
||||
|
||||
protected function formatObject ($value, $nestingLevel)
|
||||
protected function formatObject($value, $nestingLevel)
|
||||
{
|
||||
$objectVars = get_object_vars($value);
|
||||
$objectVars['class'] = get_class($value);
|
||||
|
||||
return $this->formatArray($objectVars, $nestingLevel);
|
||||
}
|
||||
|
||||
protected function formatException (\Exception $exception, $nestingLevel)
|
||||
protected function formatException(\Exception $exception, $nestingLevel)
|
||||
{
|
||||
$formattedException = array(
|
||||
'class' => get_class($exception),
|
||||
@@ -97,7 +98,7 @@ class MongoDBFormatter implements FormatterInterface
|
||||
return $this->formatArray($formattedException, $nestingLevel);
|
||||
}
|
||||
|
||||
protected function formatDate (\DateTime $value, $nestingLevel)
|
||||
protected function formatDate(\DateTime $value, $nestingLevel)
|
||||
{
|
||||
return new \MongoDate($value->getTimestamp());
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('some string', $formattedRecord['context']['context_string']);
|
||||
$this->assertEquals(123456, $formattedRecord['context']['context_int']);
|
||||
|
||||
$this->assertCount(6, $formattedRecord['context']['except']);
|
||||
$this->assertCount(5, $formattedRecord['context']['except']);
|
||||
$this->assertEquals('exception message', $formattedRecord['context']['except']['message']);
|
||||
$this->assertEquals(987, $formattedRecord['context']['except']['code']);
|
||||
$this->assertInternalType('string', $formattedRecord['context']['except']['file']);
|
||||
|
Reference in New Issue
Block a user