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:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user