ehough/epilog

This package is abandoned and no longer maintained. No replacement package was suggested.

Fork of seldaek/monolog compatible with PHP 5.2+

1.10.0 2014-06-18 23:56 UTC

This package is not auto-updated.

Last update: 2020-04-03 16:14:06 UTC


README

Build Status Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. Latest Stable Version License

This library is no longer maintained. Fork of monolog compatible with PHP 5.2+.

Motivation

monolog is a fantastic logging library, but it's only compatible with PHP 5.3+. While 97% of PHP servers run PHP 5.2 or higher, 32% of all servers are still running PHP 5.2 or lower (source). It would be a shame to exempt this library from nearly a third of the world's servers just because of a few version incompatibilities.

Once PHP 5.3+ adoption levels near closer to 100%, this library will be retired.

How to use

<?php

// create a log channel
$log = new ehough_epilog_Logger('name');
$log->pushHandler(new ehough_epilog_handler_StreamHandler('path/to/your.log', ehough_epilog_Logger::WARNING));

// add records to the log
$log->addWarning('Foo');
$log->addError('Bar');

Differences from monolog

The primary difference is naming conventions of monolog's classes. Instead of the \Monolog namespace (and sub-namespaces), instead prefix the class names with ehough_epilog and follow the PEAR naming convention.

A few examples of class naming conversions:

\Monolog\Logger                     ----->    ehough_epilog_Logger
\Monolog\Handler\StreamHandler      ----->    ehough_epilog_handler_StreamHandler
\Monolog\Processor\MemoryProcessor  ----->    ehough_epilog_processor_MemoryProcessor

Other "gotchas" when using epilog instead of monolog:

LoggerFactory

epilog also adds a handy class for building ehough_epilog_Logger instances: ehough_epilog_LoggerFactory. You can use this factory to perform one-liner instantiations:

<?php

$logger = ehough_epilog_LoggerFactory::getLogger('name');

Any loggers built this way will share the same stack of handlers and processors, thereby reducing unnecessary memory overhead.

Releases and Versioning

Releases are synchronized with the upstream monolog repository. e.g. ehough/epilog 1.6.0 has merged the code from Seldaek/monolog 1.6.0.