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

Added CategoryErrorLevelActivationStrategy, which enables setting the

Error Level threshold per log channel.
This commit is contained in:
Mike Meessen
2013-04-29 14:52:29 +02:00
parent b264026cba
commit c72aff2238
2 changed files with 61 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ namespace Monolog\Handler;
use Monolog\TestCase;
use Monolog\Logger;
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
use Monolog\Handler\FingersCrossed\CategoryErrorLevelActivationStrategy;
class FingersCrossedHandlerTest extends TestCase
{
@@ -149,6 +150,22 @@ class FingersCrossedHandlerTest extends TestCase
$this->assertTrue($test->hasWarningRecords());
}
/**
* @covers Monolog\Handler\FingersCrossedHandler::__construct
*/
public function testCategoryErrorLevelActivationStrategy()
{
$test = new TestHandler();
$handler = new FingersCrossedHandler($test, new CategoryErrorLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG)));
$handler->handle($this->getRecord(Logger::WARNING));
$this->assertFalse($test->hasWarningRecords());
$record = $this->getRecord(Logger::DEBUG);
$record['channel'] = 'othertest';
$handler->handle($record);
$this->assertTrue($test->hasDebugRecords());
$this->assertTrue($test->hasWarningRecords());
}
/**
* @covers Monolog\Handler\FingersCrossedHandler::handle
*/