good-technologies/monolog-extras

A collection of handlers, processors, and other Monolog related classes.

v1.0.0 2023-05-17 23:25 UTC

This package is auto-updated.

Last update: 2024-11-18 02:58:19 UTC


README

A collection of handlers, processors, and other Monolog related classes.

Usage instructions

composer require good-technologies/monolog-extras

The add any of the classes defined below to your Monolog set up.

Processors

  • PersonalDetailsProcessor for redacting personal details from log data using one or more PersonalDetailsHandlerInterface instances;

    Available PersonalDetailsHandlerInterface handlers are…

    Example…

      <?php
    
      use GoodTechnologies\MonologExtras\Processor\PersonalDetailsProcessor;use GoodTechnologies\MonologExtras\Processor\PersonalDetailsProcessor\EmailAddressHandler;use GoodTechnologies\MonologExtras\Processor\PersonalDetailsProcessor\IpAddressHandler;use Monolog\Handler\StreamHandler;use Monolog\Logger;
    
$logger = new Logger();

$handler = new StreamHandler('/logs/app.log')
// Add to logger
$logger->pushProcessor($personDetailsProcessor);
// Add to specific handler
$personDetailsProcessor = new PersonalDetailsProcessor([
        new EmailAddressHandler(),
        new IpAddressHandler(),
    ]);
$handler->pushProcessor($personDetailsProcessor);
$logger->pushHandler($handler);
```

Setting up dev environment

# Load some useful aliases
. ./bin/aliases

# Build docker containers
dc build

# Install dependencies
composer install