Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services
https://seldaek.github.io/monolog/
MIT License
21.02k stars 1.9k forks source link

FingersCrossedHandler Does not check passthruLevel properly #1800

Closed BrianMwit closed 1 year ago

BrianMwit commented 1 year ago

Monolog version 3.2.1

FingersCrossedHandler have an option to passthrough log line above certain level without writing out every other lines in the request. The filtering logic check each buffered log line if it is above or equals to the passthrough level threshold.

The level has been changed to enum, which means a simple more-than comparison will no longer work. https://github.com/Seldaek/monolog/blob/b05bf55097060ec20f49ccec0cf2f8e5aaa468b3/src/Monolog/Handler/FingersCrossedHandler.php#L185-L187 Should be

return $record->level->value >= $level->value;

or better

return $level->includes($record->level);

We should also update test to cover this case. https://github.com/Seldaek/monolog/blob/b05bf55097060ec20f49ccec0cf2f8e5aaa468b3/tests/Monolog/Handler/FingersCrossedHandlerTest.php#L253-L265

stof commented 1 year ago

@BrianMwit any chance that you would open a pull request containing the fix (and the updated test) ?