mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
committed by
GitHub
parent
b05bf55097
commit
06276fcf77
@@ -181,9 +181,8 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
|
|||||||
private function flushBuffer(): void
|
private function flushBuffer(): void
|
||||||
{
|
{
|
||||||
if (null !== $this->passthruLevel) {
|
if (null !== $this->passthruLevel) {
|
||||||
$level = $this->passthruLevel;
|
$this->buffer = array_filter($this->buffer, function ($record) {
|
||||||
$this->buffer = array_filter($this->buffer, function ($record) use ($level) {
|
return $this->passthruLevel->includes($record->level);
|
||||||
return $record->level >= $level;
|
|
||||||
});
|
});
|
||||||
if (count($this->buffer) > 0) {
|
if (count($this->buffer) > 0) {
|
||||||
$this->getHandler(end($this->buffer))->handleBatch($this->buffer);
|
$this->getHandler(end($this->buffer))->handleBatch($this->buffer);
|
||||||
|
@@ -259,9 +259,11 @@ class FingersCrossedHandlerTest extends TestCase
|
|||||||
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Level::Warning), 0, true, true, Level::Info);
|
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Level::Warning), 0, true, true, Level::Info);
|
||||||
$handler->handle($this->getRecord(Level::Debug));
|
$handler->handle($this->getRecord(Level::Debug));
|
||||||
$handler->handle($this->getRecord(Level::Info));
|
$handler->handle($this->getRecord(Level::Info));
|
||||||
|
$handler->handle($this->getRecord(Level::Notice));
|
||||||
$handler->close();
|
$handler->close();
|
||||||
$this->assertFalse($test->hasDebugRecords());
|
$this->assertFalse($test->hasDebugRecords());
|
||||||
$this->assertTrue($test->hasInfoRecords());
|
$this->assertTrue($test->hasInfoRecords());
|
||||||
|
$this->assertTrue($test->hasNoticeRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,8 +275,10 @@ class FingersCrossedHandlerTest extends TestCase
|
|||||||
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Level::Warning), 0, true, true, LogLevel::INFO);
|
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Level::Warning), 0, true, true, LogLevel::INFO);
|
||||||
$handler->handle($this->getRecord(Level::Debug));
|
$handler->handle($this->getRecord(Level::Debug));
|
||||||
$handler->handle($this->getRecord(Level::Info));
|
$handler->handle($this->getRecord(Level::Info));
|
||||||
|
$handler->handle($this->getRecord(Level::Notice));
|
||||||
$handler->close();
|
$handler->close();
|
||||||
$this->assertFalse($test->hasDebugRecords());
|
$this->assertFalse($test->hasDebugRecords());
|
||||||
$this->assertTrue($test->hasInfoRecords());
|
$this->assertTrue($test->hasInfoRecords());
|
||||||
|
$this->assertTrue($test->hasNoticeRecords());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user