mouf/utils.log.psr.multi-logger

This package contains a PSR-3 compatible logger that wrap a set of loggers

v1.1.0 2024-07-25 12:33 UTC

This package is auto-updated.

Last update: 2024-10-25 12:56:34 UTC


README

This package contains a PSR-3 compliant composite logger class.

In practice, this class does not log anything but delegates logging to one or many PSR-3 compliant loggers. This is useful when you want to call multiple loggers at one.

Install

composer require mouf/utils.log.psr.multi-logger

Usage

Simply pass an array of loggers to the multi-logger:

$logger1 = new MyLogger();
$logger2 = new AnotherLogger();

$multiLogger = new Mouf\Utils\Log\Psr\MultiLogger([ $logger1, $logger2 ]);

You can also add loggers using the addLogger method:

$logger1 = new MyLogger();
$logger2 = new AnotherLogger();

$multiLogger = new Mouf\Utils\Log\Psr\MultiLogger();
$multiLogger->addLogger($logger1);
$multiLogger->addLogger($logger2);