1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-14 00:54:01 +02:00

Added configuration option to MemoryProcessors with a possibility to disable formatting.

This commit is contained in:
Hennadiy Verkh
2014-03-24 10:51:45 +01:00
parent 392ef35fd4
commit 36f3d0e52f
5 changed files with 45 additions and 7 deletions

View File

@@ -26,4 +26,17 @@ class MemoryPeakUsageProcessorTest extends TestCase
$this->assertArrayHasKey('memory_peak_usage', $record['extra']);
$this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']);
}
/**
* @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
* @covers Monolog\Processor\MemoryProcessor::formatBytes
*/
public function testProcessorWithoutFormatting()
{
$processor = new MemoryPeakUsageProcessor(true, false);
$record = $processor($this->getRecord());
$this->assertArrayHasKey('memory_peak_usage', $record['extra']);
$this->assertInternalType('int', $record['extra']['memory_peak_usage']);
$this->assertGreaterThan(0, $record['extra']['memory_peak_usage']);
}
}

View File

@@ -26,4 +26,17 @@ class MemoryUsageProcessorTest extends TestCase
$this->assertArrayHasKey('memory_usage', $record['extra']);
$this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']);
}
/**
* @covers Monolog\Processor\MemoryUsageProcessor::__invoke
* @covers Monolog\Processor\MemoryProcessor::formatBytes
*/
public function testProcessorWithoutFormatting()
{
$processor = new MemoryUsageProcessor(true, false);
$record = $processor($this->getRecord());
$this->assertArrayHasKey('memory_usage', $record['extra']);
$this->assertInternalType('int', $record['extra']['memory_usage']);
$this->assertGreaterThan(0, $record['extra']['memory_usage']);
}
}