mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 06:06:40 +02:00
Fix bug with level in GitProcessor (#1749)
This commit is contained in:
@@ -44,7 +44,7 @@ class GitProcessor implements ProcessorInterface
|
||||
public function __invoke(LogRecord $record): LogRecord
|
||||
{
|
||||
// return if the level is not high enough
|
||||
if ($record->level < $this->level) {
|
||||
if ($record->level->isLowerThan($this->level)) {
|
||||
return $record;
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Monolog\Processor;
|
||||
|
||||
use Monolog\Level;
|
||||
use Monolog\Test\TestCase;
|
||||
|
||||
class GitProcessorTest extends TestCase
|
||||
@@ -26,4 +27,15 @@ class GitProcessorTest extends TestCase
|
||||
$this->assertArrayHasKey('git', $record->extra);
|
||||
$this->assertTrue(!is_array($record->extra['git']['branch']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Processor\GitProcessor::__invoke
|
||||
*/
|
||||
public function testProcessorWithLevel()
|
||||
{
|
||||
$processor = new GitProcessor(Level::Error);
|
||||
$record = $processor($this->getRecord());
|
||||
|
||||
$this->assertArrayNotHasKey('git', $record->extra);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user