Installs: 70

Dependents: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0 2014-11-18 15:02 UTC


DEPRECATED (use this)

Build Status Latest Stable Version Total Downloads License

A standards-compliant Logger (psr-3) with support for some extended features.

So, why not just go with monolog?

Monolog comes with an impressive amount of logger-adapters ready for production.

Could these adapters not just be loggers themself? Yes, they could but for some reason they are not. Because of that, you are bound to the adapters shipped with monolog (or adapters ready on packagist, or just write your own). We have a standard (psr-3) and I believe all we need is a composite-object that holds many psr-3-loggers and notify them with new messages - at least this is what monolog does, but with non-standard adapters.

You can simply use LoggerCollection which also implements the LoggerInterface to replace Monolog\Logger. Then add as many psr-3-compliant Loggers to LoggerCollection as you like, wrap them in extenders, filters or formatters and gain more control about how your messages are treated.

LoggerCollection for composite logging

$errorLogger = new LoggerCollection();
$errorLogger->add(new ErrorLogLogger()); 
$errorLogger->add(new PushoverLogger(/* ... */));

$logger = new LoggerCollection();
$logger->add(new LogLevelRangeFilterProxy($errorLogger, LogLevel::ERROR, LogLevel::EMERGENCY));
$logger->add(new ResourceLogger(STDOUT));

$logger->error("This is a log messages");

ExtendedLogger for sub-loggers

You can create subloggers from a logger-instance. The reason is to have a base-context for all deriving log-messages. So you can track, where a certain log-message came from.

$psrLogger = ...;
$logger = new ExtendedPsrLoggerWrapper($psrLogger, new CommonCaptionRenderer());
$subLogger = $logger->createSubLogger('Sub-Routine');
$subLogger = $logger->createSubLogger('Sub-Sub-Routine');
$subLogger->notice('Hello World'); // Sub-Routine / Sub-Sub-Routine: Hello World

Rfc5424LogLevels and LogLevelTranslator for log-level conversion

$psrLogLevel = Psr\Log\LogLevel::DEBUG;
$rfc5454LogLevel = 7 - LogLevelTranslator::getLevelNo($psrLogLevel);
$rfc5454WarningLevel = 7 - LogLevelTranslator::getLevelNo(Psr\Log\LogLevel::WARNING);
if($rfc5454LogLevel >= $rfc5454WarningLevel) {
    $logger->log($psrLogLevel, $message, array());

Exclude a single log level with the SingleLogLevelFilterProxy

Define a single log-level to be excluded.

$logger = new SingleLogLevelFilterProxy(new StreamLogger(STDOUT), LogLevel::DEBUG);

Only include a certain range of log levels with the LogLevelRangeFilterProxy

Define a range of valid log-levels.

$logger = new LoggerCollection();
$logger->add(new SingleLogLevelFilterProxy(new StreamLogger(STDOUT), LogLevel::INFO, LogLevel::ERROR));
$logger->add(new SingleLogLevelFilterProxy(new StreamLogger(STDERR), LogLevel::ERROR, LogLevel::EMERGENCY));


Add a message prefix to all messages with the MessagePrefixProxy

Add a prefix to all log messages:

$logger = new MessagePrefixProxy(new ResourceLogger(STDOUT), 'AddCustomer: ');


Filter log-messages by a user defined callback filter.


  • ErrorLogLogger
  • StreamLogger
  • ResourceLogger
  • UdpLogger
  • NullLogger