[GH-ISSUE #569] Can we please supply complete $record to Handler::isHandling? #196

Closed
opened 2026-03-04 02:13:04 +03:00 by kerem · 2 comments
Owner

Originally created by @rpkamp on GitHub (Jun 1, 2015).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/569

Logger::addRecord() on line 241 now reads

if ($handler->isHandling(array('level' => $level))) {
// ....
}

while this used to be

if ($handler->isHandling($record)) {
// ....
}

In our current setup we check if a handler needs to be handling a message based on some value in $record['context'] but obviously we can't check this anymore because of this change.

Could this change be reverted and pass the full $record again to Handler::isHandling?

Originally created by @rpkamp on GitHub (Jun 1, 2015). Original GitHub issue: https://github.com/Seldaek/monolog/issues/569 Logger::addRecord() on line 241 now reads ``` if ($handler->isHandling(array('level' => $level))) { // .... } ``` while this used to be ``` if ($handler->isHandling($record)) { // .... } ``` In our current setup we check if a handler needs to be handling a message based on some value in `$record['context']` but obviously we can't check this anymore because of this change. Could this change be reverted and pass the full `$record` again to `Handler::isHandling`?
kerem closed this issue 2026-03-04 02:13:04 +03:00
Author
Owner

@Seldaek commented on GitHub (Jun 1, 2015):

The idea was to do a very slim check before calling anything, but you can just return true there based on level and then ignore records that you don't want in handle() it should be harmless. See github.com/Seldaek/monolog@556c56483f/src/Monolog/Handler/HandlerInterface.php (L24-30) for details.

<!-- gh-comment-id:107679596 --> @Seldaek commented on GitHub (Jun 1, 2015): The idea was to do a very slim check before calling anything, but you can just return true there based on level and then ignore records that you don't want in handle() it should be harmless. See https://github.com/Seldaek/monolog/blob/556c56483f687517c62cda1b74f792ecc1e7de9b/src/Monolog/Handler/HandlerInterface.php#L24-30 for details.
Author
Owner

@Seldaek commented on GitHub (Jun 1, 2015):

Moreover we added a Logger::isHandling($level) that couldn't do its job properly anymore if we sent a full record to HandlerInterface::isHandling so I'm afraid it was a one way trip :)

<!-- gh-comment-id:107679994 --> @Seldaek commented on GitHub (Jun 1, 2015): Moreover we added a Logger::isHandling($level) that couldn't do its job properly anymore if we sent a full record to HandlerInterface::isHandling so I'm afraid it was a one way trip :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#196
No description provided.