mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-21 16:46:11 +02:00
made change BC
This commit is contained in:
@@ -12,9 +12,7 @@
|
||||
namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
|
||||
|
||||
use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
|
||||
|
||||
use Monolog\Logger;
|
||||
|
||||
/**
|
||||
@@ -37,15 +35,22 @@ class FingersCrossedHandler extends AbstractHandler
|
||||
|
||||
/**
|
||||
* @param callback|HandlerInterface $handler Handler or factory callback($record, $fingersCrossedHandler).
|
||||
* @param ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
|
||||
* @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
|
||||
* @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
||||
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true)
|
||||
*/
|
||||
public function __construct($handler, ActivationStrategyInterface $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true)
|
||||
public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true)
|
||||
{
|
||||
if (null === $activationStrategy) {
|
||||
$activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING);
|
||||
}
|
||||
if (!$activationStrategy instanceof ActivationStrategyInterface) {
|
||||
$activationStrategy = new ErrorLevelActivationStrategy($activationStrategy);
|
||||
}
|
||||
|
||||
$this->handler = $handler;
|
||||
$this->activationStrategy = $activationStrategy ?: new ErrorLevelActivationStrategy(Logger::WARNING);
|
||||
$this->activationStrategy = $activationStrategy;
|
||||
$this->bufferSize = $bufferSize;
|
||||
$this->bubble = $bubble;
|
||||
$this->stopBuffering = $stopBuffering;
|
||||
|
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
|
||||
|
||||
use Monolog\TestCase;
|
||||
use Monolog\Logger;
|
||||
|
||||
@@ -71,7 +69,7 @@ class FingersCrossedHandlerTest extends TestCase
|
||||
public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
|
||||
{
|
||||
$test = new TestHandler();
|
||||
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, false, false);
|
||||
$handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false);
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::WARNING));
|
||||
$handler->handle($this->getRecord(Logger::INFO));
|
||||
@@ -86,7 +84,7 @@ class FingersCrossedHandlerTest extends TestCase
|
||||
public function testHandleBufferLimit()
|
||||
{
|
||||
$test = new TestHandler();
|
||||
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 2);
|
||||
$handler = new FingersCrossedHandler($test, Logger::WARNING, 2);
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::INFO));
|
||||
@@ -132,7 +130,7 @@ class FingersCrossedHandlerTest extends TestCase
|
||||
public function testIsHandlingAlways()
|
||||
{
|
||||
$test = new TestHandler();
|
||||
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::ERROR));
|
||||
$handler = new FingersCrossedHandler($test, Logger::ERROR);
|
||||
$this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user