mimmi20/monolog-callbackfilterhandler

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

4.0.0 2024-12-03 15:48 UTC

README

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

Requirements

This handler works with PHP 8.1 or above

Installation

Run

composer require mimmi20/monolog-callbackfilterhandler

Features

  • 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.

Example

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.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.