mimmi20/monolog-callbackfilterhandler

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# CallbackFilterHandler for Monolog

This library is a Fork of [llaville/monolog-callbackfilterhandler](https://github.com/llaville/monolog-callbackfilterhandler) with updates for Monolog 3.

[![Latest Stable Version](https://poser.pugx.org/mimmi20/monolog-callbackfilterhandler/v/stable?format=flat-square)](https://packagist.org/packages/mimmi20/monolog-callbackfilterhandler)
[![Latest Unstable Version](https://poser.pugx.org/mimmi20/monolog-callbackfilterhandler/v/unstable?format=flat-square)](https://packagist.org/packages/mimmi20/monolog-callbackfilterhandler)
[![License](https://poser.pugx.org/mimmi20/monolog-callbackfilterhandler/license?format=flat-square)](https://packagist.org/packages/mimmi20/monolog-callbackfilterhandler)

## Code Status

[![codecov](https://codecov.io/gh/mimmi20/monolog-callbackfilterhandler/branch/master/graph/badge.svg)](https://codecov.io/gh/mimmi20/monolog-callbackfilterhandler)
[![Test Coverage](https://api.codeclimate.com/v1/badges/8debc6c572634c0d5cd7/test_coverage)](https://codeclimate.com/github/mimmi20/monolog-callbackfilterhandler/test_coverage)
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/mimmi20/monolog-callbackfilterhandler.svg)](https://isitmaintained.com/project/mimmi20/monolog-callbackfilterhandler "Average time to resolve an issue")
[![Percentage of issues still open](https://isitmaintained.com/badge/open/mimmi20/monolog-callbackfilterhandler.svg)](https://isitmaintained.com/project/mimmi20/monolog-callbackfilterhandler "Percentage of issues still open")
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmimmi20%2Fmonolog-callbackfilterhandler%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/mimmi20/monolog-callbackfilterhandler/master)
[![Maintainability](https://api.codeclimate.com/v1/badges/8debc6c572634c0d5cd7/maintainability)](https://codeclimate.com/github/mimmi20/monolog-callbackfilterhandler/maintainability)

## Requirements

This handler works with PHP 8.1 or above

## Installation

Run

```shell
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](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/FilterHandler.php)
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](https://github.com/mimmi20/monolog-callbackfilterhandler/blob/master/examples/basic.php) file.

## License

This package is licensed using the MIT License.

Please have a look at [`LICENSE.md`](LICENSE.md).