Skip to content

zamronypj/zzzlogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZzzLogger

Collection of PSR-3 LoggerInterface implementation.

Requirement

Installation

Run through composer

$ composer require juhara/zzzlogger

Available LoggerInterface implementation

  • TeeLogger LoggerInterface implementation that duplicate log to two other loggers.
  • ManyLogger LoggerInterface implementation that duplicate log to many loggers.

How to use

TeeLogger class

Combine two different loggers as one logger. For example using Monolog to log to file and PHP Debug bar to log to html page.

<?php
$monolog = new Monolog\Logger\Logger();
$debugbar = new \DebugBar\StandardDebugBar();
...
$teeLogger = new \Juhara\ZzzLogger\TeeLogger($monolog, $debugbar['messages']);
$teeLogger->info('hello world');
$teeLogger->warning('world climate change warning');

Daisy chain loggers to combine more than two loggers as one logger.

<?php
$teeLogger1 = new \Juhara\ZzzLogger\TeeLogger($logger1, $logger2);
$teeLogger = new \Juhara\ZzzLogger\TeeLogger($teeLogger1, $logger3);
$teeLogger->info('hello world');
$teeLogger->warning('world climate change warning');

ManyLogger class

Combine many loggers as one logger.

<?php
$manyLogger = new \Juhara\ZzzLogger\ManyLogger([$logger1, $logger2, $logger3]);
$manyLogger->info('hello world');
$manyLogger->warning('world climate change warning');

Contributing

If you have any improvement or issues please submit PR.

Thank you.

Packages

No packages published

Languages