Monolog handler wrapper that filters records based on a list of callback functions

3.0.6 2024-05-24 15:10 UTC


This library is a Fork of llaville/monolog-callbackfilterhandler with updates for Monolog 3.

Latest Stable Version Latest Unstable Version License

Code Status

codecov Test Coverage Average time to resolve an issue Percentage of issues still open Mutation testing badge Maintainability


This handler works with PHP 8.1 or above



composer require mimmi20/monolog-callbackfilterhandler


  • This handler obey first to basic Monolog rules as handler level and bubble.
  • Then, in second time, logs are filtered by rules defined in one or more callback functions.

Main difference with FilterHandler included in standard Monolog distribution since version 1.8.0

  • FilterHandler can just filter records and only allow those of a given list of levels through to the wrapped handler.
  • CallbackFilterHandler may filter records to the wrapped handler, on each standard record elements including extra data and logging context.


Here is a basic setup to log all events to a file and most important to another one (or notify by mail). See examples/basic.php file.


This package is licensed using the MIT License.

Please have a look at LICENSE.md.