1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 08:36:33 +02:00

Make context optional in hasRecord to not break backwards compatibility

This commit is contained in:
Petter Blomberg
2018-05-31 15:34:07 +02:00
committed by Jordi Boggiano
parent b381a973bc
commit f753c68a73
2 changed files with 32 additions and 34 deletions

View File

@@ -86,18 +86,16 @@ class TestHandler extends AbstractProcessingHandler
public function hasRecord($record, $level)
{
if (is_string($record)) {
$record = array('message' => $record);
}
return $this->hasRecordThatPasses(function ($rec) use ($record) {
if (is_array($record)) {
if ($rec['message'] !== $record['message']) {
return false;
}
if ($rec['context'] !== $record['context']) {
return false;
}
} else {
if ($rec['message'] !== $record) {
return false;
}
if ($rec['message'] !== $record['message']) {
return false;
}
if (isset($record['context']) && $rec['context'] !== $record['context']) {
return false;
}
return true;
}, $level);